/*! oms 2019-03-08 */
define("/common/js/app", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //注册组件 , 帖子列表
    var app = function(params) {
        app.wxLoad = null;
        //app.wx = require("jweixin");
        app.params = {
            versions: "6.7",
            userVersions: "2.4",
            urlChangeFromComponent: 1,
            debug: true,
            urlCache: {},
            loadPage: 0,
            plugUrl: "/",
            apiDomain: "http://tenement.com/",
            //不带"/"
            //domain: 'http://www.codecamp.com', 
            loginUrl: "https://login.bestsmartbee.com/"
        };
        for (var i in params) {
            app.params[i] = params[i];
        }
        app.pageData = {};
        var fun = {
            setWxShareData: function() {
                if (!app.isWeiXin()) {
                    return;
                }
                if (app.params.DefShareData) {
                    app.wxDefShare(app.params.DefShareData);
                } else {}
            },
            isWeiXin: function() {
                //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息，这个属性可以用来判断浏览器类型
                var ua = window.navigator.userAgent.toLowerCase();
                //通过正则表达式匹配ua中是否含有MicroMessenger字符串
                if (ua.match(/MicroMessenger/i) == "micromessenger") {
                    return true;
                } else {
                    return false;
                }
            },
            isAlipay: function() {
                //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息，这个属性可以用来判断浏览器类型
                var ua = window.navigator.userAgent.toLowerCase();
                if (ua.match(/Alipay/i) == "alipay") {
                    return true;
                } else {
                    return false;
                }
            },
            //实例化VueApp
            init: function() {
                //创建和挂载根实例
                var VueApp = new Vue({
                    router: router,
                    watch: {
                        // 如果路由有变化，会再次执行该方法
                        $route: "fetchData"
                    },
                    mounted: function() {
                        this.fetchData();
                        app.setWxShareData();
                    },
                    methods: {
                        fetchData: function() {
                            //  console.log(this.$route);
                            var name = this.$route.name;
                            var options = app.findOptionsByName(name);
                            if (!options.name) {
                                return;
                            }
                            var hash = window.location.hash;
                            if (hash && hash.indexOf("component_") > -1) {
                                return false;
                            }
                            var id = "#page" + app.ucfirst(name);
                            var wrap = "#router-view-tmp";
                            //页面是要缓存的
                            if (options.page == "cache") {
                                wrap = "#router-view-cache";
                            } else {
                                wrap = "#router-view-tmp";
                                // 如果是组件路由发生变化，不清缓存
                                // if(app.params.urlChangeFromComponent==1){
                                //     $(wrap).html("");
                                // }
                                // console.log(app.params.preRoute);
                                // if ($(id).length > 0  && $(id).attr('url') !=window.location.href) {
                                //    var url = $(id).attr('url');
                                //    $(id).remove();
                                // }
                                if ($(id).length > 0) {
                                    $(id).remove();
                                }
                            }
                            if ($(id).length > 0 && $(id).attr("url") != window.location.href) {
                                var url = $(id).attr("url");
                                $(id).remove();
                            }
                            app.params.preRoute = name;
                            $(".page").addClass("cached").removeClass("pageShow");
                            var loadingPage = '<div class="loadingPage" style="text-align: center;margin-top: 100px;">正在为您努力加载页面。。。。</div>';
                            $("body").append(loadingPage);
                            if (options.title) {
                                app.setTitle(options.title);
                            }
                            if ($(id).length > 0) {
                                $(id).removeClass("cached").addClass("pageShow");
                                $(".loadingPage").remove();
                                var pageVm = app.getVm(name);
                                if (pageVm) {
                                    typeof pageVm.pageShow === "function" ? pageVm.pageShow() : "";
                                }
                                if (typeof app.pageShow == "function") {
                                    app.pageShow({
                                        name: name,
                                        vm: pageVm
                                    });
                                }
                            } else {
                                app.routePage(name, wrap);
                            }
                        }
                    }
                }).$mount("#app");
                if (typeof app.afterInit == "function") {
                    app.afterInit();
                }
            },
            // 加载组件
            component: function(name, params) {
                // app.params.urlChangeFromComponent=1;
                require.async("/component/template_js/" + name, function(html) {
                    // console.log(html);
                    var id = "component_" + name;
                    app.popup(id, html, "body");
                    window.location.href = "#" + id;
                    $(".popupBg").remove();
                    require.async("/component/" + name, function(component) {
                        component.vue(params);
                        // app.params.urlChangeFromComponent=0;
                        $("#" + id).addClass("page").addClass("popup_page");
                    });
                });
            },
            wxShare: function(params, callblack) {
                var data = {
                    title: params["title"],
                    // 分享标题
                    link: params["url"] ? params["url"] : window.location.href,
                    // 分享链接
                    imgUrl: params["imgUrl"],
                    // 分享图标
                    desc: params["desc"],
                    success: function() {},
                    cancel: function() {}
                };
                app.wx(function(wx) {
                    // console.log(data);
                    wx.onMenuShareTimeline(data);
                    wx.onMenuShareAppMessage(data);
                    callblack ? callblack() : "";
                });
            },
            wx: function(callblack) {
                require.async("jweixin", function(wx) {
                    app.wx = wx;
                    typeof callblack == "function" ? callblack(wx) : "";
                });
            },
            //传入一个name ， 会加载对应的html ,和js , 生成id : page-id
            routePage: function(name, wrap, ajax) {
                if (!name) {
                    return false;
                }
                // console.log(name);
                // component
                // 默认的
                if (!wrap) {
                    wrap = "#router-view-tmp";
                }
                var id = "page" + app.ucfirst(name);
                console.log("template_js/" + name);
                require.async("template_js/" + name, function(content) {
                    if (typeof content == "string") {
                        content = content.replace(/<img/g, "<img onerror=\"javascript:this.src='https://img.bestsmartbee.com/1536138807127'\" ");
                    }
                    var url = window.location.href;
                    if (ajax == 1) {
                        content = $("<div>" + content + "</div>").find(".ajaxPageContent").html();
                        content = "<div url=" + url + " id='" + id + "'>" + content + "</div>";
                    } else {
                        content = "<div url=" + url + " class='page pageShow' id='" + id + "'>" + content + "</div>";
                    }
                    var wrapContent = $(content);
                    $(wrapContent).hide();
                    $(wrapContent).appendTo(wrap);
                    var pageId = "#" + id;
                    var options = {
                        name: name
                    };
                    // console.log("js/" + name);
                    require.async("js/" + name, function(controller) {
                        // console.log(options);
                        // console.log(options,controller.pageShow);
                        controller.vue(options);
                        var vm = controller.vm;
                        $(pageId).show();
                        $(".loadingPage").remove();
                        if ($(pageId).find(".page-content").length > 0) {
                            app.scrollPreventDefault($(pageId).find(".page-content").eq(0));
                        }
                        if (typeof vm.pageShow == "function") {
                            vm.pageShow(options);
                        }
                        if (typeof app.pageShow == "function") {
                            options.vm = controller.vm;
                            app.pageShow(options);
                        }
                    });
                });
            },
            //禁用滚动
            scrollPreventDefault: function(pageContent) {
                function pageContentTouchstart() {
                    var el = this;
                    var top = el.scrollTop, totalScroll = el.scrollHeight, currentScroll = top + el.offsetHeight;
                    if (top === 0) {
                        $(el).attr("_isScroller", 1);
                        el.scrollTop = 2;
                    } else if (currentScroll === totalScroll) {
                        $(el).attr("_isScroller", 1);
                        el.scrollTop = top - 2;
                    }
                }
                function pageContentTouchmove() {
                    var el = this;
                    var top = el.scrollTop, totalScroll = el.scrollHeight, currentScroll = top + el.offsetHeight;
                    if (top === 0) {
                        $(el).attr("_isScroller", 0);
                    } else if (currentScroll === totalScroll) {
                        $(el).attr("_isScroller", 0);
                    }
                }
                function preventDefault(evt) {
                    var _isScroller = $(".pageShow .page-content").attr("_isScroller");
                    //pageContent 滚动到底部或顶部时禁用滚动
                    if (_isScroller == "0") {
                        evt.preventDefault();
                    }
                }
                //判断pageContent 滚动的位置， 如果滚动到顶部或底部， 禁用滚动
                $(pageContent).unbind("touchstart", pageContentTouchstart).bind("touchstart", pageContentTouchstart);
                $(pageContent).unbind("touchmove", pageContentTouchmove).bind("touchstart", pageContentTouchmove);
                //当pageContent顶部或底部， body是不能能滚动
                $("body").unbind("touchmove", preventDefault).bind("touchmove", preventDefault);
                //评价用户作品添加滚动效果
                // $(".add-comment-info").on("touchmove", function(event) {
                //     event.stopPropagation();
                // });
                // $(".add-comment-info").on("touchend", function(event) {
                //     event.stopPropagation();
                //     document.body.scrollTop = 0;
                // });
                //头部不能能滚动
                $("#header").unbind("touchmove").bind("touchmove", function(evt) {
                    evt.preventDefault();
                });
                //底部不能能滚动
                $(".bottom-fixed").unbind("touchmove").bind("touchmove", function(evt) {
                    evt.preventDefault();
                });
            },
            //找到这路由的配置
            findOptionsByName: function(name) {
                var options = router.options.routes;
                for (var item in options) {
                    if (name == options[item]["name"]) {
                        return options[item];
                    }
                }
                return {};
            },
            confirm: function(params) {
                //  $(".confirm").remove();
                // $("body").find(".popupBg").remove();
                var confirmText = params.confirmText ? params.confirmText : "确定";
                var cancelText = params.cancelText ? params.cancelText : "取消";
                var html = '<div class="confirm" id="appConfirm">';
                html += '<div class="confirm-text">' + params.text + "</div>";
                html += '<ul class="confirm-options">';
                html += '<li class="bl">' + cancelText + "</li> <li>" + confirmText + "</li>";
                html += "</ul>";
                html += "</div>";
                var yes = params.yes;
                $("body").append(html);
                // if ($("body").find(".popupBg").length > 0) {
                //     $("body").find(".popupBg").remove();
                // }
                $('<div class="popupBg"></div>').insertBefore("#appConfirm");
                $(".popupBg").unbind("click").bind("click", function() {
                    app.confirmNo();
                });
                $("#appConfirm .confirm-options li").eq(0).click(function() {
                    app.confirmNo(params.no);
                });
                var left = $(".confirm").width() / 2;
                $(".confirm").css("margin-left", "-" + left + "px");
                $("#appConfirm .confirm-options li").eq(1).click(function() {
                    app.confirmNo();
                    yes ? yes() : "";
                });
            },
            confirmNo: function() {
                $(".confirm").remove();
                $("body").find(".popupBg").remove();
            },
            //操作选项
            handle: function(params) {
                var optionsHtml = "";
                for (var i in params) {
                    optionsHtml += '<div class="handle-options-one">' + params[i]["text"] + "</div>";
                }
                var html = '<div class="handle-options">';
                html += '<div class="handle-options-group">';
                html += optionsHtml;
                html += " </div>";
                html += '<div class="handle-options-last colse">取消</div>';
                html += " </div>";
                app.popup("handle", html);
                $(".handle-options-one").click(function() {
                    var callblack = params[$(this).index()]["methods"];
                    callblack ? callblack() : "";
                    $("#handle").prev().remove();
                    $("#handle").remove();
                });
            },
            colseHandle: function() {
                $("body").find(".popupBg").remove();
                $("#handle").remove();
            },
            //popup 弹出方式
            popup: function(id, content, container) {
                if ($("body").find("#" + id).length > 0) {
                    $("body").find("#" + id).remove();
                }
                var html = '<div class="popup" id="' + id + '">' + content + "</div>";
                if (container) {
                    $(container).append(html);
                } else {
                    $(".pageShow").append(html);
                }
                app.show_popup("#" + id);
            },
            //
            show_popup: function(popupId) {
                if ($("body").find(".popupBg").length > 0) {
                    $("body").find(".popupBg").remove();
                }
                $('<div class="popupBg"></div>').insertBefore(popupId);
                $(popupId).addClass("popup-modal-in");
                $(".popupBg").bind("click", function() {
                    app.hide_popup();
                });
                $(popupId).find(".colse").bind("click", function() {
                    app.hide_popup();
                });
            },
            hide_popup: function() {
                $(".popup").removeClass("popup-modal-in");
                $("body").find(".popupBg").remove();
            },
            //图片加载延迟
            picLazyLoad: function(imgs, fn) {
                require.async("plug/picLazyLoad", function(picLazyLoad) {
                    picLazyLoad.watch(imgs, fn);
                });
            },
            //copy  //  data-clipboard-text="Just because you can doesn't mean you should — clipboard.js"
            copy: function(id, callblack) {
                require.async("plug/clipboard.min", function(clipboard) {
                    var clipboard = new ClipboardJS(id);
                    clipboard.on("success", function(e) {
                        e.clearSelection();
                        callblack ? callblack(e) : "";
                    });
                    clipboard.on("error", function(e) {
                        callblack ? callblack(e) : "";
                    });
                });
            },
            //首字母大写
            ucfirst: function(str) {
                if (typeof str !== "string") {
                    return "";
                }
                var strs = str.split("/");
                var res = "";
                for (var i in strs) {
                    str = strs[i];
                    //var str = str.toLowerCase();
                    str = str.replace(/\b\w+\b/g, function(word) {
                        return word.substring(0, 1).toUpperCase() + word.substring(1);
                    });
                    res += str;
                }
                return res;
            },
            setTitle: function(title) {
                $("#app-title").text(title);
                $("title").html(title);
            },
            showLoad: function() {
                //$("body").append("<div class='dialog loading'></div>");
                var html = '<div class="loader loader--style1" title="0">';
                html += '<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"';
                html += ' width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">';
                html += '<path opacity="0.2" fill="#000" d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946';
                html += "  s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634";
                html += ' c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"/>';
                html += '<path fill="#000" d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0';
                html += '   C22.32,8.481,24.301,9.057,26.013,10.047z">';
                html += ' <animateTransform attributeType="xml"';
                html += '  attributeName="transform"';
                html += '  type="rotate"';
                html += ' from="0 20 20"';
                html += ' to="360 20 20"';
                html += ' dur="0.5s"';
                html += ' repeatCount="indefinite"/>';
                html += " </path>";
                html += "</svg>";
                html += "</div>";
                if ($("body").find(".loader--style1").length === 0) {
                    $("body").append(html);
                }
                $(".loader--style1").show();
            },
            hideLoad: function() {
                //$(".loading").remove();
                $(".loader--style1").hide();
            },
            //检查TOKEN 是否过期
            checkToken: function(callblack) {
                app.get("apiv2/user/checkToken", function(res) {
                    if (res.code != 200) {
                        app.delUserInfo();
                        app.auth();
                    } else {
                        callblack ? callblack() : "";
                    }
                });
            },
            login: function(callblack, fields) {
                var backUrl = window.location.href;
                var box_login_code = "";
                var Request = app.GetRequest(backUrl);
                var UserInfo = app.getUserInfo();
                // console.log("UserInfo:",UserInfo);
                if (UserInfo && UserInfo.user_id) {
                    app.checkToken(function() {
                        typeof callblack == "function" ? callblack(UserInfo) : "";
                    });
                } else if (Request && Request.token) {
                    var userInfoUrl = app.params.loginUrl + "index/getUserInfoByToken/?token=" + Request.token;
                    app.showLoad();
                    $.ajax({
                        url: userInfoUrl,
                        //可以不是本地域名 
                        type: "get",
                        data: {
                            fields: fields ? fields : "user_id,store_id,phone,nickname,phone,avatarUrl"
                        },
                        dataType: "jsonp",
                        //jsonp格式访问
                        success: function(data) {
                            if (data.code > 0) {
                                app.alert(data.msg);
                                app.relogin();
                            } else {
                                app.setUserInfo(data.userInfo);
                                app.hideLoad();
                                typeof callblack == "function" ? callblack(data.userInfo) : "";
                            }
                        },
                        error: function() {
                            app.relogin();
                        }
                    });
                } else {
                    // var appId = app.getAppId();
                    // https://login.bestsmartbee.com/index/synclogin?inviteId=0&backUrl=http%3A%2F%2Ftenement.com%2Fadmin%2Fhome%2Findex
                    // console.log(loginUrl);
                    app.auth();
                }
            },
            relogin: function(text) {
                app.confirm({
                    text: text ? text : "授权登录发现异常，是否重新登录？",
                    yes: function() {
                        app.auth();
                    }
                });
            },
            auth: function() {
                var backUrl = window.location.href;
                var search = app.GetRequest(window.location.search);
                var store_id = search.store_id ? search.store_id : 0;
                var loginUrl;
                if (app.isWeiXin()) {
                    loginUrl = app.params.loginUrl + "index/getopenid/?store_id=" + store_id + "&backUrl=" + window.escape(backUrl);
                } else if (app.isAlipay()) {
                    loginUrl = app.params.loginUrl + "index/loginH5ByAlipay/?act=getUserId&store_id=" + store_id + "&backUrl=" + window.escape(backUrl);
                } else {
                    loginUrl = app.params.loginUrl + "index/synclogin/?store_id=" + store_id + "&backUrl=" + window.escape(backUrl);
                }
                // alert(loginUrl);
                window.location.href = loginUrl;
            },
            getStoreId: function() {
                var search = app.GetRequest(window.location.search);
                var store_id = search.store_id ? search.store_id : 0;
                return store_id;
            },
            getStore: function(callback) {
                var store_id = app.getStoreId();
                app.get("api/user/getStore", {
                    store_id: store_id
                }, function(res) {
                    callback ? callback(res.data) : "";
                });
            },
            getAppId: function() {
                var Request = app.GetRequest(window.location.href);
                if (Request.appId) {
                    return Request.appId;
                } else {
                    return "";
                }
            },
            wxJs: function(callblack) {
                if (app.wxLoad) {
                    typeof callblack == "function" ? callblack(app.wx) : "";
                    return;
                }
                app.get("api/wechat_tool/wxJs", function(signPackage) {
                    app.wx(function(wx) {
                        app.wxLoad = 1;
                        wx.config({
                            debug: false,
                            appId: signPackage.appId,
                            timestamp: signPackage.timestamp,
                            nonceStr: signPackage.nonceStr,
                            signature: signPackage.signature,
                            jsApiList: [ "onMenuShareTimeline", "onMenuShareAppMessage", "addCard", "chooseCard", "openCard", "chooseWXPay", "previewImage", "openLocation", "getLocation", "openAddress" ]
                        });
                        wx.ready(function() {
                            //alert(callblack);
                            typeof callblack == "function" ? callblack(wx) : "";
                        });
                        wx.error(function(res) {
                            //alert(callblack);
                            app.wxLoad = 0;
                            app.saveLog(res);
                            app.alert(res.errMsg);
                        });
                    });
                });
            },
            GetRequest: function(url) {
                var theRequest = new Object();
                if (url.indexOf("?") != -1) {
                    var str = url.split("?");
                    str = str[1];
                    var strs = str.split("&");
                    for (var i = 0; i < strs.length; i++) {
                        var v = strs[i].split("=")[1];
                        theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
                    }
                }
                return theRequest;
            },
            alert: function(msg, callblack) {
                //alert("<div class='dialog'>"+msg+"</div>");
                if (typeof msg != "string") {
                    msg = JSON.stringify(msg);
                }
                $("body").append("<div class='dialog'>" + msg + "</div>");
                var width = $(".dialog").width() / 2;
                var h = $(".dialog").height() / 2;
                $(".dialog").css({
                    "margin-left": "-" + width + "px",
                    "margin-top": "-" + h + "px"
                });
                setTimeout(function() {
                    $(".dialog").remove();
                    typeof callblack == "function" ? callblack() : "";
                }, 1e3);
            },
            //版本号
            getVersions: function() {
                return app.params.versions;
            },
            //用户信息
            getUserInfo: function(type) {
                var store_id = app.getStoreId();
                var userVersions = app.params.userVersions + store_id;
                var UserInfo = app.cache(userVersions).get("UserInfo");
                if (UserInfo && UserInfo.token) {
                    //callblack ? callblack(UserInfo) : "";
                    // UserInfo.user_id = 36;
                    // UserInfo.token='cca001ac8014eb17284d9545335abe12';
                    return UserInfo;
                }
                return {};
            },
            setUserInfo: function(userInfo) {
                // var userVersions = app.params.userVersions;
                var store_id = app.getStoreId();
                var userVersions = app.params.userVersions + store_id;
                if (userInfo && userInfo.user_id && userInfo.token) {
                    var search = app.GetRequest(window.location.search);
                    delete search.token;
                    $.extend(userInfo, search);
                    var UserInfo = app.cache(userVersions).set("UserInfo", userInfo);
                }
            },
            delUserInfo: function(userInfo) {
                // var userVersions = app.params.userVersions;
                var store_id = app.getStoreId();
                var userVersions = app.params.userVersions + store_id;
                app.cache(userVersions).rm("UserInfo");
            },
            get: function(url, params, callblack) {
                app.showLoad();
                // console.log(params);
                var args = typeof params == "object" ? params : {};
                callblack = $.isFunction(params) ? params : callblack;
                var UserInfo = app.getUserInfo();
                if (UserInfo && UserInfo.token) {
                    args.token = UserInfo.token;
                }
                app.ajax({
                    type: "GET",
                    dataType: "json",
                    data: args,
                    success: function(res) {
                        // console.log(res);
                        callblack(res);
                    },
                    url: app.params.apiDomain + url
                });
            },
            post: function(url, params, callblack) {
                app.showLoad();
                // console.log(params);
                var args = typeof params == "object" ? params : {};
                callblack = $.isFunction(params) ? params : callblack;
                app.ajax({
                    type: "POST",
                    dataType: "json",
                    data: args,
                    success: function(res) {
                        callblack(res);
                    },
                    url: app.params.apiDomain + url
                });
            },
            loadCss: function(url) {
                url = app.params.plugUrl + url;
                var css_id = app.base64_encode(url);
                if (!app.params.urlCache[css_id]) {
                    app.params.urlCache[css_id] = css_id;
                    $("head").append('<link href="' + url + '" id="css_id_' + css_id + '" rel="stylesheet" type="text/css" />');
                }
            },
            //无限加载
            pager: function(id, callblack) {
                //$(window).unbind('scroll');
                function pagerContent() {
                    var bot = 100;
                    //bot是底部距离的高度
                    var nDivHight = $(this).height();
                    var nScrollHight = $(this)[0].scrollHeight;
                    var nScrollTop = $(this)[0].scrollTop;
                    if (nScrollTop + nDivHight + bot >= nScrollHight && app.params.loadPage == "0") {
                        $.isFunction(callblack) ? callblack() : "";
                    }
                }
                // console.log(id);
                $(id).find(".page-content").unbind("scroll", pagerContent);
                $(id).find(".page-content").scroll(pagerContent);
            },
            picker: function(id, params) {
                app.loadCss("plug/weui2/css/picker.css");
                // console.log(app.params.plugUrl +"plug/weui2/js/zepto.weui.min.js");
                app.getScript("plug/weui2/js/zepto.weui.min.js", function() {
                    $(id).picker(params);
                });
            },
            datetimePickerWap: function(id, params) {
                app.getScript("plug/weui2/js/zepto.weui.min.js", function() {
                    $(id).datetimePicker(params);
                });
            },
            cityPicker: function(id, params) {
                app.loadCss("plug/weui2/css/picker.css");
                app.getScript("plug/weui2/js/zepto.weui.min.js", function() {
                    app.getScript("plug/weui2/js/picker.city.js", function() {
                        $(id).cityPicker(params);
                    });
                });
            },
            upload: function(obj, callblack) {
                app.loadCss("plug/photo/photo.css");
                require.async(app.params.plugUrl + "plug/photo/photo.js", function(photo) {
                    photo.initUpload($(obj));
                    callblack ? callblack() : "";
                });
            },
            MultipleUpload: function(obj, callblack) {
                app.loadCss("plug/photo/photo.css");
                require.async(app.params.plugUrl + "plug/photo/photo.js", function(photo) {
                    photo.initMultipleUpload($(obj));
                    callblack ? callblack() : "";
                });
            },
            //时间插件
            datetimepicker: function(_this) {
                app.loadCss("plug/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css");
                app.loadCss("plug/bootstrap-datetimepicker/css/datetimepicker.css");
                app.getScript("plug/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js", function() {
                    app.getScript("plug/bootstrap-datetimepicker/js/bootstrap-datetimepicker.zh-CN.js", function() {
                        $(_this).datetimepicker({
                            language: "zh-CN",
                            autoclose: 1,
                            minView: $(_this).attr("data-minview") ? $(_this).attr("data-minview") : 2
                        });
                    });
                });
            },
            lCalendar: function(id) {
                app.loadCss("plug/lCalendar.css");
                app.getScript("plug/lCalendar.min.js", function() {
                    var calendar = new lCalendar();
                    // alert($("#"+id).attr("type"));
                    calendar.init({
                        trigger: "#" + id,
                        type: $("#" + id).attr("data-type") ? $("#" + id).attr("data-type") : "date"
                    });
                });
            },
            _getScript: function(url, callback) {
                var head = document.getElementsByTagName("head")[0], js = document.createElement("script");
                js.setAttribute("type", "text/javascript");
                js.setAttribute("src", url);
                head.appendChild(js);
                //执行回调
                var callbackFn = function() {
                    if (typeof callback === "function") {
                        callback();
                    }
                };
                if (document.all) {
                    //IE
                    js.onreadystatechange = function() {
                        if (js.readyState == "loaded" || js.readyState == "complete") {
                            callbackFn();
                        }
                    };
                } else {
                    js.onload = function() {
                        callbackFn();
                    };
                }
            },
            //加载js
            getScript: function(url, callblack, versions) {
                url = app.params.plugUrl + url;
                app._getScript(url, function() {
                    callblack ? callblack() : "";
                });
            },
            ajax: function(params) {
                var userInfo = app.getUserInfo();
                var userInfoSearch = {};
                var search = app.GetRequest(window.location.search);
                delete search.token;
                if (userInfo) {
                    userInfoSearch = {
                        store_id: userInfo.store_id,
                        token: userInfo.token
                    };
                    if (userInfo.appid) {
                        userInfoSearch.appid = userInfo.appid;
                    }
                    if (userInfo.appid) {
                        userInfoSearch.openid = userInfo.openid;
                    }
                }
                // console.log(userInfoSearch);
                // return;
                $.extend(userInfoSearch, search);
                params = params ? params : {};
                if ($.isArray(params["data"])) {
                    for (var i in params["data"]) {
                        // userInfoSearch.push({
                        //       name:i,
                        //       value:params["data"][i]
                        //   });
                        userInfoSearch[params["data"][i]["name"]] = params["data"][i]["value"];
                    }
                    params["data"] = userInfoSearch;
                } else {
                    $.extend(userInfoSearch, params["data"]);
                    params["data"] = userInfoSearch;
                }
                console.log(userInfoSearch);
                var ajaxTimeoutTest = $.ajax({
                    url: params["url"],
                    type: params["type"],
                    dataType: params["dataType"],
                    data: params["data"],
                    cache: false,
                    timeout: 1e4,
                    beforeSend: function() {
                        app.showLoad();
                    },
                    success: function(result) {
                        var success = params["success"];
                        typeof success == "function" ? success(result) : "";
                    },
                    complete: function(msg, status) {
                        // console.log(msg.response);
                        app.hideLoad();
                        if (status == "timeout") {
                            //超时,status还有success,error等值的情况                       　　　　　
                            ajaxTimeoutTest.abort();
                            app.alert("由于网络原因，请求超时，请刷新网页试试");
                            app.saveLog("由于网络原因，请求超时，请刷新网页试试");
                        }
                        if (params["cache"]) {
                            var key = app.base64_encode(params["url"]);
                            var result = msg.response;
                            app.params.urlCache[key] = result;
                            app.cache().set(key, result);
                        }
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        app.saveLog(errorThrown);
                        console.log(errorThrown);
                    }
                });
            },
            //保存错误日志
            saveLog: function(msg) {
                console.log(msg);
            },
            //轮播图
            swiper: function(id) {
                app.loadCss("plug/Swiper-4.4.2/css/swiper.min.css");
                app.getScript("plug/Swiper-4.4.2/js/swiper.min.js", function() {
                    var swiper = new window.Swiper("#" + id, {
                        pagination: "#" + id + " .swiper-pagination",
                        //nextButton: '#swiper_<{$data.name}> .swiper-button-next',
                        //prevButton: '#swiper_<{$data.name}> .swiper-button-prev',
                        loop: true,
                        spaceBetween: 30,
                        centeredSlides: true,
                        autoplay: 5e3
                    });
                }, false);
            },
            //页面切换
            swiperPage: function(id, callblack) {
                //  app.loadCss("plug/Swiper-3.3.1/swiper.css");
                app.getScript("plug/Swiper-3.3.1/swiper-3.4.1.jquery.min.js", function() {
                    //绑定滚动事件,记住滚动位置
                    // var swiperH=$(id).attr("swiperH");
                    // var swiperT=$(id).attr("swiperT");
                    var pageContent = $(id).parents(".page-content");
                    var swiperWrap = $(id + "-container");
                    $(swiperWrap).find(".swiperTap").find(".active").addClass("scrollActive");
                    $(pageContent).scroll(function(event) {
                        var swiperIndex = $(swiperWrap).find(".swiperTap").find(".scrollActive");
                        var scrollTop = $(this).scrollTop();
                        var scroll = $(swiperIndex).attr("scroll");
                        if (scroll != "0") {
                            $(swiperIndex).attr("scrollTop", scrollTop);
                        }
                    });
                    var swiper = new window.Swiper(id, {
                        pareanContainer: id + "-container",
                        //autoHeight:true,
                        onTransitionStart: function(swiper) {
                            var pageContent = $(id).parents(".page-content");
                            $(pageContent).addClass("overflowhidden");
                            $(swiperWrap).find(".swiperTap li").attr("scroll", "0");
                        },
                        onTransitionEnd: function(swiper) {
                            var activeIndex = swiper.activeIndex;
                            var swiperWrap = $(id + "-container");
                            $(swiperWrap).find(".swiperTap li").removeClass("scrollActive");
                            $(swiperWrap).find(".swiperTap").find("li").eq(activeIndex).addClass("scrollActive");
                            $(swiperWrap).find(".swiperTap li").attr("scroll", "1");
                            $(pageContent).removeClass("overflowhidden");
                        },
                        onSlideChangeEnd: function(swiper) {
                            var activeIndex = swiper.activeIndex;
                            var swiperWrap = $(id + "-container");
                            var scrollTop = $(swiperWrap).find(".swiperTap li").eq(activeIndex).attr("scrollTop");
                            $(id).parents(".page-content").scrollTop(scrollTop);
                            $(pageContent).removeClass("overflowhidden");
                        },
                        onSlideChangeStart: function(swiper) {
                            var activeIndex = swiper.activeIndex;
                            var slideActive = $(id).find(".swiper-slide").eq(activeIndex);
                            $(id).find(".swiper-slide").addClass("swiper-slide-hide");
                            slideActive.removeClass("swiper-slide-hide");
                            var load = slideActive.attr("load");
                            var name = slideActive.attr("name");
                            if (load != 1 && name) {
                                app.routePage(name, slideActive, 1);
                                slideActive.attr("load", 1);
                            }
                            var swiperWrap = $(id + "-container");
                            $(swiperWrap).find(".swiperTap li").removeClass("active");
                            $(swiperWrap).find(".swiperTap li").eq(activeIndex).addClass("active");
                            //alert(callblack);
                            //滚动到原来位置
                            // alert($(slideActive).height());
                            //$(id).height(($(slideActive).height()));
                            callblack ? callblack(swiper) : "";
                        },
                        onTouchMove: function(swiper, e) {
                            var activeIndex = swiper.activeIndex;
                            var container = $(id + "-container");
                            var transform = $(container).find(".swiper-wrapper").css("transform");
                            var w = swiper.width;
                            var li_w = $(container).find(".swiperTap li").eq(activeIndex).width();
                            if (typeof transform == "string" && transform && transform.indexOf("translate3d(") == "0") {
                                if (transform.indexOf("translate3d(") == "0") {
                                    var transforms = transform.substring(13).split(",");
                                    var transformsW = Number(transforms[0].replace(/px/g, ""));
                                    var transform_x = (transformsW - activeIndex * w) / w * li_w;
                                }
                            } else {
                                return false;
                            }
                            $(container).parents(".page").find(".nav-tab-fix li").eq(activeIndex).find(".swiperTapLine").css("left", transform_x + "px");
                            if ($(container).parents(".page").find(".nav-tab-fix li").length) {
                                $(container).find(".swiperTap li").eq(activeIndex).find(".swiperTapLine").css("left", transform_x + "px");
                            }
                        },
                        onTouchEnd: function(swiper, e) {
                            var container = $(id + "-container");
                            var activeIndex = swiper.activeIndex;
                            $(container).find(".swiperTap li").find(".swiperTapLine").css("left", "0px");
                            if ($(container).parents(".page").find(".nav-tab-fix li").length) {
                                $(container).parents(".page").find(".nav-tab-fix li").find(".swiperTapLine").css("left", "0px");
                            }
                        }
                    });
                    //绑定点击事件
                    var length = $(id).find(".swiper-slide").length;
                    $(id + "-container").find(".swiperTap li").click(function(event) {
                        var index = $(this).index();
                        if (length > index) {
                            swiper.slideTo(index);
                        }
                    });
                    if ($(id + "-container").parents(".page").find(".nav-tab-fix li").length) {
                        $(id + "-container").parents(".page").find(".nav-tab-fix li").click(function(event) {
                            var index = $(this).index();
                            if (length > index) {
                                swiper.slideTo(index);
                            }
                        });
                    }
                }, false);
            },
            /*
             * Javascript base64_encode() base64加密函数
             用于生成字符串对应的base64加密字符串
             * 吴先成  www.51-n.com ohcc@163.com QQ:229256237
             * @param string str 原始字符串
             * @return string 加密后的base64字符串
             */
            base64_encode: function(str) {
                var c1, c2, c3;
                var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
                var i = 0, len = str.length, string = "";
                while (i < len) {
                    c1 = str.charCodeAt(i++) & 255;
                    if (i == len) {
                        string += base64EncodeChars.charAt(c1 >> 2);
                        string += base64EncodeChars.charAt((c1 & 3) << 4);
                        string += "==";
                        break;
                    }
                    c2 = str.charCodeAt(i++);
                    if (i == len) {
                        string += base64EncodeChars.charAt(c1 >> 2);
                        string += base64EncodeChars.charAt((c1 & 3) << 4 | (c2 & 240) >> 4);
                        string += base64EncodeChars.charAt((c2 & 15) << 2);
                        string += "=";
                        break;
                    }
                    c3 = str.charCodeAt(i++);
                    string += base64EncodeChars.charAt(c1 >> 2);
                    string += base64EncodeChars.charAt((c1 & 3) << 4 | (c2 & 240) >> 4);
                    string += base64EncodeChars.charAt((c2 & 15) << 2 | (c3 & 192) >> 6);
                    string += base64EncodeChars.charAt(c3 & 63);
                }
                return string;
            },
            /*
             * Javascript base64_decode() base64解密函数
             用于解密base64加密的字符串
             * 吴先成  www.51-n.com ohcc@163.com QQ:229256237
             * @param string str base64加密字符串
             * @return string 解密后的字符串
             */
            base64_decode: function(str) {
                var c1, c2, c3, c4;
                var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
                var i = 0, len = str.length, string = "";
                while (i < len) {
                    do {
                        c1 = base64DecodeChars[str.charCodeAt(i++) & 255];
                    } while (i < len && c1 == -1);
                    if (c1 == -1) break;
                    do {
                        c2 = base64DecodeChars[str.charCodeAt(i++) & 255];
                    } while (i < len && c2 == -1);
                    if (c2 == -1) break;
                    string += String.fromCharCode(c1 << 2 | (c2 & 48) >> 4);
                    do {
                        c3 = str.charCodeAt(i++) & 255;
                        if (c3 == 61) return string;
                        c3 = base64DecodeChars[c3];
                    } while (i < len && c3 == -1);
                    if (c3 == -1) break;
                    string += String.fromCharCode((c2 & 15) << 4 | (c3 & 60) >> 2);
                    do {
                        c4 = str.charCodeAt(i++) & 255;
                        if (c4 == 61) return string;
                        c4 = base64DecodeChars[c4];
                    } while (i < len && c4 == -1);
                    if (c4 == -1) break;
                    string += String.fromCharCode((c3 & 3) << 6 | c4);
                }
                return string;
            },
            //缓存
            cache: function(v) {
                var versions = v ? v : app.getVersions();
                var cacheFun = {
                    set: function(key, data) {
                        var value;
                        key = key + "_" + versions;
                        if (typeof data == "object") {
                            data = JSON.stringify(data);
                            value = "obj-" + data;
                        } else {
                            value = "str-" + data;
                        }
                        try {
                            localStorage.setItem(key, value);
                        } catch (err) {
                            if (err.name == "QuotaExceededError") {
                                localStorage.clear();
                                //如果缓存已满则清空
                                localStorage.setItem(key, value);
                            }
                        }
                    },
                    rm: function(key) {
                        key = key + "_" + versions;
                        localStorage.removeItem(key);
                    },
                    get: function(key) {
                        key = key + "_" + versions;
                        var value = localStorage.getItem(key);
                        if (value == null) {
                            return null;
                        }
                        var type = value.substr(0, 4);
                        if (type == "str-") {
                            return value.substr(4);
                        }
                        if (type == "obj-") {
                            var data = value.substr(4);
                            return $.parseJSON(data);
                        }
                    },
                    clear: function() {
                        localStorage.clear();
                    }
                };
                return cacheFun;
            },
            //微信默认分享
            wxDefShare: function(params) {
                if (typeof params == "undefined") {
                    var wxShareData = {
                        title: "跟着普象君有肉吃",
                        // 分享标题
                        imgUrl: "https://www.lgstatic.com/thumbnail_300x300/image1/M00/00/47/Cgo8PFTUXOOAbTbtAAA-0t30W6k220.jpg",
                        // 分享图标
                        desc: "等你好久了，终于来了"
                    };
                } else {
                    wxShareData = params;
                }
                app.wxShare(wxShareData);
            },
            // get vue vm
            getVm: function(name) {
                if (typeof name == "string") {
                    name = "js/" + name;
                    return seajs.Module.get(require.resolve(name)) && seajs.Module.get(require.resolve(name)).exports && seajs.Module.get(require.resolve(name)).exports.vm;
                } else {
                    return null;
                }
            },
            setPageData: function(pageName, data) {
                var curData = this.pageData[pageName] ? this.pageData[pageName] : {};
                // console.log("setPageData",data);
                for (var i in data) {
                    //console.log("i", i, data[i]);
                    curData[i] = data[i];
                }
                this.pageData[pageName] = curData;
            },
            getPageData: function(pageName, key) {
                var curData = this.pageData[pageName];
                if (key) {
                    return curData ? curData[key] : null;
                } else {
                    return curData;
                }
            },
            area: function(_this) {
                app.getScript("plug/area.js", function() {
                    $(_this).attr("domain", app.params.apiDomain);
                    $(_this).area();
                });
            },
            areaForbank: function(_this) {
                app.getScript("plug/areaForbank.js", function() {
                    $(_this).attr("domain", app.params.apiDomain);
                    $(_this).area();
                });
            },
            pay: function(order_sn, type) {
                var payurl = app.params.apiDomain + "apiv2/pay/run/?order_sn=" + order_sn;
                if (type) {
                    payurl += "&paytype=" + type;
                }
                if (ua.match(/MicroMessenger/i) == "micromessenger") {
                    //判断是否是微信环境
                    //微信环境
                    wx.miniProgram.getEnv(function(res) {
                        if (res.miniprogram) {
                            wx.miniProgram.navigateTo({
                                url: "/pages/pay/index?order_sn=" + order_sn
                            });
                            return false;
                        }
                    });
                }
                window.location.href = payurl;
            }
        };
        $.extend(true, app, fun);
        return app;
    };
    module.exports = app;
});

'use strict';

define(function (require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function () {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    data: ''

                };
            },
            el: '#pageBookDetail',
            created: function created() {
                this.fetchData();
            },
            methods: {
                fetchData: function fetchData() {
                    this.loadOrder();
                },
                // onShow:function(){
                //    this.loadOrder();
                // },
                setData: function setData(arr) {
                    for (var i in arr) {
                        this[i] = arr[i];
                    }
                },

                loadOrder: function loadOrder() {
                    var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

                    var that = this;
                    if (reload == 1) {
                        app.setPageData("oms/order", { reload: 1 });
                    }
                    app.get("apiv2/order/find", {
                        order_sn: this.$route.params.order_sn
                    }, function (res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.data = res.data;
                    });
                },

                //确认接单
                book_receiving: function book_receiving(order_sn) {

                    var that = this;
                    app.get('/mall/dining_table_book/receiving', {
                        order_sn: order_sn
                    }, function (data) {
                        if (data.code == 200) {
                            app.alert('操作成功');
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },

                //取消
                book_cancel: function book_cancel(order_sn) {

                    var that = this;
                    app.get('/mall/dining_table_book/cancel', {
                        order_sn: order_sn

                    }, function (data) {
                        if (data.code == 200) {
                            app.alert('操作成功');
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },

                //取消
                book_complete: function book_complete(order_sn) {

                    var that = this;
                    app.get('/mall/dining_table_book/complete', {
                        order_sn: order_sn

                    }, function (data) {
                        if (data.code == 200) {
                            app.alert('操作成功');
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                }
            }

        }).$mount('#app');
    };
    module.exports = controller;
});

'use strict';

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {
          data: '',
          popup3: 0,
          remark: '',
          refund_money: 0
        };
      },
      el: '#pageEatInHallOrder',
      created: function created() {
        this.fetchData();
      },
      methods: {
        fetchData: function fetchData() {
          this.loadOrder();
        },
        //  onShow:function(){
        //    this.loadOrder();
        // },

        setData: function setData(arr) {
          for (var i in arr) {
            this[i] = arr[i];
          }
        },

        loadOrder: function loadOrder() {
          var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

          var that = this;
          app.get("apiv2/order/find", {
            order_sn: this.$route.params.order_sn
          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            that.data = res.data;
          });
        },

        //出餐中
        eat_in_hall_receiving: function eat_in_hall_receiving(order_sn) {
          // var order_sn = $(e.target).attr("order_sn");
          // var shop_id = $(e.target).attr("shop_id");
          var that = this;
          app.get('mall/eat_in_hall_order/receiving', {
            order_sn: order_sn
          }, function (data) {
            if (data.code == 200) {
              app.alert("操作成功");
              that.loadOrder(1);
            } else {
              app.alert(data.msg);
            }
          });
        },

        //出餐完成
        eat_in_hall_complete: function eat_in_hall_complete(order_sn) {

          var that = this;
          app.get('mall/eat_in_hall_order/complete', {
            order_sn: order_sn
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.loadOrder(1);
            } else {
              app.alert(data.msg);
            }
          });
        },


        //取消 退款
        eat_in_hall_cancel: function eat_in_hall_cancel() {
          var that = this;
          that.setData({
            loading: 1,
            disabled: 1
          });
          // if (!this.remark){
          //   app.alert('请输入备注!');
          //   return ;
          // }
          // if (!this.refund_money ) {
          //   app.alert('请输入退回金额!');
          //   return;
          // }
          app.get('mall/eat_in_hall_order/cancel', {
            order_sn: this.order_sn,
            refund_desc: this.remark,
            refund_money: this.refund_money
            //  method: 'POST',
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.hide_refund_money();
              that.loadOrder(1);
            } else {
              app.alert(data.msg);
              that.setData({
                loading: 0,
                disabled: 0
              });
            }
          });
        },
        show_refund_money: function show_refund_money(e) {
          var order_sn = $(e.target).attr("order_sn");

          var refund_money = $(e.target).attr("refund_money");
          var paystatus = $(e.target).attr("paystatus");
          this.setData({
            order_sn: order_sn,
            refund_money: refund_money
          });
          if (refund_money > 0 && paystatus == 1) {
            this.setData({
              popup3: 1
            });
          } else {
            this.eat_in_hall_cancel();
          }
        },
        hide_refund_money: function hide_refund_money() {
          this.popup3 = 0;
        }

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

'use strict';

define(function (require) {
    var PuthinkApp = require('app');
    //vue 组件
    // require('js/component');
    //zach
    //配置文件
    var params = {
        apiDomain: seajs.data.apiDomain ? seajs.data.apiDomain : 'https://www.bestsmartbee.com/', //接口域名 不带"/"
        domain: '', //网站域名  不带"/",
        appname: seajs.data.appname,
        debug: seajs.data.debug ? seajs.data.debug : false,
        versions: seajs.data.versions ? seajs.data.versions : '6.8',
        userVersions: seajs.data.userVersions ? seajs.data.userVersions : '6.9'
    };

    //app 实例之后 ， 只执行一次
    PuthinkApp.afterInit = function () {
        var _hmt = _hmt || [];
    };

    //页面显示时引用，每次都会执行
    PuthinkApp.pageShow = function (params) {
        var name = params.name;
        // console.log();
    };

    //实例化app
    window.app = new PuthinkApp(params);
    app.login(function () {
        app.init();
    });
});

'use strict';

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {
          loading: 0,
          page: 1,
          status: 0,
          lastpage: 0,
          listData: [],
          orderPrintloading: {},
          orderPrintdisabled: {},
          popup3: 0,
          popup: 0,
          popup2: 0,
          remark: '',
          nodata: 0,
          refund_money: 0
        };
      },
      el: '#pageOrder',
      created: function created() {
        this.fetchData();
      },
      mounted: function mounted() {
        // console.log("123");
        if (this.mounted == 1) {
          return;
        }

        var that = this;
        app.pager("#pageOrder", function () {
          that.loadOderList();
        });
        this.mounted = 1;
      },
      methods: {
        fetchData: function fetchData() {
          if (this.$route.params.status) {
            this.status = this.$route.params.status;
          }
          this.loadOderList();
        },

        setStatus: function setStatus(status) {
          // var status = $(e.target).attr("data-status");

          if (this.status === status) {
            return;
          }
          console.log(status);
          this.status = status;

          this.loadOderList(1);
        },
        topay: function topay(e) {},

        loadOderList: function loadOderList(reload) {
          var that = this;

          if (reload == 1) {
            this.loading = 0;
            this.page = 1;
            this.lastpage = 0;

            this.nodata = 0;
          }

          var page = this.page;
          if (this.loading == 1 || this.lastpage == 1) {
            return;
          }

          this.loading = 1;
          app.get("apiv2/order/get", {
            page: page,
            limit: 10,
            status: this.status,
            order: 'addtime desc'
          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            // console.log(res);
            if (res.data.list.length === 0) {
              that.lastpage = 1;
            }
            that.page++;
            if (reload == 1) {
              that.listData = res.data.list;
            } else {
              var listData = that.listData;
              that.listData = listData.concat(res.data.list);
            }

            if (that.listData.length === 0) {
              that.nodata = 1;
            } else {
              that.nodata = 0;
            }
          });
        },

        pageShow: function pageShow() {
          var reload = app.getPageData("oms/order", 'reload');
          console.log(reload);
          if (reload) {
            app.setPageData("oms/order", { reload: 0 });
            this.loadOderList(1);
          }
        },

        // 取消定
        cancel_order: function cancel_order() {
          if (this.order_type == "shopping") {
            this.shopping_cancel();
          } else if (this.order_type == "book") {
            this.book_cancel();
          } else if (this.order_type == "eat_in_hall") {
            this.eat_in_hall_cancel();
          }
        },
        show_refund_money: function show_refund_money(e) {
          var order_sn = $(e.target).attr("order_sn");
          var refund_money = $(e.target).attr("refund_money");
          var paystatus = $(e.target).attr("paystatus");
          var order_type = $(e.target).attr("order_type");
          this.setData({
            order_sn: order_sn,
            refund_money: refund_money,
            order_type: order_type
          });
          if (refund_money > 0 && paystatus == 1) {
            this.setData({
              popup3: 1
            });
          } else {
            this.cancel_order();
          }
        },
        hide_refund_money: function hide_refund_money() {
          this.popup3 = 0;
        },

        //确认接单
        book_receiving: function book_receiving(order_sn) {

          var that = this;
          app.get('/mall/dining_table_book/receiving', {
            order_sn: order_sn
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
            }
          });
        },

        //取消
        book_cancel: function book_cancel(order_sn) {

          var that = this;
          app.get('/mall/dining_table_book/cancel', {
            order_sn: order_sn

          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
            }
          });
        },

        //取消
        book_complete: function book_complete(order_sn) {

          var that = this;
          app.get('/mall/dining_table_book/complete', {
            order_sn: order_sn

          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
            }
          });
        },


        // 取消订单
        shopping_cancel: function shopping_cancel() {
          var that = this;
          app.get('/mall/order/cancel', {
            order_sn: this.order_sn,
            refund_desc: this.remark,
            refund_money: this.refund_money
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
            }
          });
        },


        //确认接单
        shopping_receiving: function shopping_receiving(order_sn) {

          var that = this;
          app.get('/mall/order/receiving', {
            order_sn: order_sn
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
            }
          });
        },


        //配送完成
        shopping_complete: function shopping_complete(order_sn) {
          var that = this;
          app.get('/mall/order/complete', {
            order_sn: order_sn
          }, function (data) {
            if (data.code == 200) {

              app.alert('操作成功');
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
            }
          });
        },


        //选择配送
        deliverMallOrder: function deliverMallOrder(e) {
          var that = this;
          this.shop_id = $(e.target).attr("shop_id");
          this.order_sn = $(e.target).attr("order_sn");
          app.handle([{
            text: '自营配送',
            methods: function methods() {
              that.popup = 1;
            }
          }, {
            text: '蜂鸟配送',
            methods: function methods() {
              that.popup2 = 1;
            }
          }]);
        },

        //自己配送
        deliver_diy: function deliver_diy(e) {

          var that = this;
          that.setData({
            loading: 1,
            disabled: 1
          });
          app.post('mall/order/delivery_diy', {
            order_sn: this.order_sn,
            remark: $("#formSubmit").find("[name='remark']").val(),
            tracking_number: $("#formSubmit").find("[name='tracking_number']").val(),
            method: 'POST'
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.popup = 0;
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
              that.setData({
                loading: 0,
                disabled: 0
              });
            }
          });
        },

        //蜂鸟配送
        deliver: function deliver(e) {
          // remark: $("#formSubmit").find("[name='remark']").val(),
          //   tracking_number: $("#formSubmit").find("[name='tracking_number']").val(),
          //   shop_id: this.shop_id,
          var that = this;
          that.setData({
            loading: 1,
            disabled: 1
          });
          var url = 'mall/order/delivery_dada';
          if (this.data.type == 'ele') {
            url = 'mall/order/delivery_ele';
          }
          app.post(url, {
            order_sn: this.data.order_sn,
            remark: $("#formSubmit2").find("[name='remark']").val(),
            order_weight: $("#formSubmit2").find("[name='order_weight']").val(),
            method: 'POST'
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.popup2 = 0;
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
              that.setData({
                loading: 0,
                disabled: 0
              });
            }
          });
        },

        //打印小票
        orderPrint: function orderPrint(e) {
          var order_sn = $(e.target).attr("order_sn");
          var shop_id = $(e.target).attr("shop_id");
          var that = this;
          var tmp = {};
          tmp[order_sn] = 1;
          this.setData({
            orderPrintloading: tmp,
            orderPrintdisabled: tmp
          });
          app.get('mall-admin/mall-order/orderPrint', {
            order_sn: order_sn,
            shop_id: shop_id
          }, function (data) {
            tmp[order_sn] = 0;
            that.setData({
              orderPrintloading: tmp,
              orderPrintdisabled: tmp
            });
            if (data.error === 0) {
              app.alert('打印指令发送成功');
            } else {
              app.alert(data.msg);
            }
          });
        },


        //出餐中
        eat_in_hall_receiving: function eat_in_hall_receiving(order_sn) {
          // var order_sn = $(e.target).attr("order_sn");
          // var shop_id = $(e.target).attr("shop_id");
          var that = this;
          app.get('mall/eat_in_hall_order/receiving', {
            order_sn: order_sn
          }, function (data) {
            if (data.code == 200) {
              app.alert("操作成功");
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
            }
          });
        },

        //出餐完成
        eat_in_hall_complete: function eat_in_hall_complete(order_sn) {

          var that = this;
          app.get('mall/eat_in_hall_order/complete', {
            order_sn: order_sn
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
            }
          });
        },


        //取消 退款
        eat_in_hall_cancel: function eat_in_hall_cancel() {
          var that = this;
          that.setData({
            loading: 1,
            disabled: 1
          });
          // if (!this.remark){
          //   app.alert('请输入备注!');
          //   return ;
          // }
          // if (!this.refund_money ) {
          //   app.alert('请输入退回金额!');
          //   return;
          // }
          app.get('mall/eat_in_hall_order/cancel', {
            order_sn: this.order_sn,
            refund_desc: this.remark,
            refund_money: this.refund_money
            //  method: 'POST',
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.hide_refund_money();
              that.loadOderList(1);
            } else {
              app.alert(data.msg);
              that.setData({
                loading: 0,
                disabled: 0
              });
            }
          });
        },

        setData: function setData(arr) {
          for (var i in arr) {
            this[i] = arr[i];
          }
        }

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

'use strict';

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {
          data: '',
          prinrting: 0,
          mainorder: {},
          popup3: 0,
          popup: 0,
          popup2: 0,
          remark: '',
          refund_money: 0
        };
      },
      el: '#pageOrderDetail',
      created: function created() {
        this.fetchData();
      },
      methods: {
        fetchData: function fetchData() {
          this.loadOrder();
        },
        // onShow:function(){
        //    this.loadOrder();
        // },

        loadOrder: function loadOrder() {
          var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

          var that = this;
          if (reload == 1) {
            app.setPageData("oms/order", { reload: 1 });
          }
          this.loading = 1;
          // app.get("mall/order/find", {
          //   order_sn: this.$route.params.order_sn
          // }, function (res) {
          //   that.loading = 0;
          //   if (res.code != 200) {
          //     app.alert(res.msg);
          //     return;
          //   }
          //   that.data= res.data;

          // });

          app.get("apiv2/order/find", {
            order_sn: this.$route.params.order_sn
          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            that.mainorder = res.data;
            that.data = res.data.sub_order;
          });
        },

        show_refund_money: function show_refund_money(e) {
          var order_sn = $(e.target).attr("order_sn");
          var refund_money = $(e.target).attr("refund_money");
          var paystatus = $(e.target).attr("paystatus");
          var order_type = $(e.target).attr("order_type");
          this.setData({
            order_sn: order_sn,
            refund_money: refund_money,
            order_type: order_type
          });
          if (refund_money > 0 && paystatus == 1) {
            this.setData({
              popup3: 1
            });
          } else {
            this.cancel_order();
          }
        },
        hide_refund_money: function hide_refund_money() {
          this.popup3 = 0;
        },

        // 取消定
        cancel_order: function cancel_order() {
          if (this.order_type == "shopping") {
            this.shopping_cancel();
          } else if (this.order_type == "book") {
            this.book_cancel();
          } else if (this.order_type == "eat_in_hall") {
            this.eat_in_hall_cancel();
          }
        },

        // 取消订单
        shopping_cancel: function shopping_cancel() {
          var that = this;
          app.get('/mall/order/cancel', {
            order_sn: this.order_sn,
            refund_desc: this.remark,
            refund_money: this.refund_money
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.loadOrder(1);
            } else {
              app.alert(data.msg);
            }
          });
        },


        //确认接单
        shopping_receiving: function shopping_receiving(order_sn) {

          var that = this;
          app.get('/mall/order/receiving', {
            order_sn: order_sn
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.loadOrder(1);
            } else {
              app.alert(data.msg);
            }
          });
        },


        //配送完成
        shopping_complete: function shopping_complete(order_sn) {
          var that = this;
          app.get('/mall/order/complete', {
            order_sn: order_sn
          }, function (data) {
            if (data.code == 200) {

              app.alert('操作成功');
              that.loadOrder(1);
            } else {
              app.alert(data.msg);
            }
          });
        },


        //选择配送
        deliverMallOrder: function deliverMallOrder(e) {
          var that = this;
          this.shop_id = $(e.target).attr("shop_id");
          this.order_sn = $(e.target).attr("order_sn");
          app.handle([{
            text: '自营配送',
            methods: function methods() {
              that.popup = 1;
            }
          }, {
            text: '蜂鸟配送',
            methods: function methods() {
              that.popup2 = 1;
            }
          }]);
        },

        //自己配送
        deliver_diy: function deliver_diy(e) {

          var that = this;
          that.setData({
            loading: 1,
            disabled: 1
          });
          app.post('mall/order/delivery_diy', {
            order_sn: this.order_sn,
            remark: $("#formSubmit").find("[name='remark']").val(),
            tracking_number: $("#formSubmit").find("[name='tracking_number']").val(),
            method: 'POST'
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.popup = 0;
              that.loadOrder(1);
            } else {
              app.alert(data.msg);
              that.setData({
                loading: 0,
                disabled: 0
              });
            }
          });
        },

        //蜂鸟配送
        deliver: function deliver(e) {
          // remark: $("#formSubmit").find("[name='remark']").val(),
          //   tracking_number: $("#formSubmit").find("[name='tracking_number']").val(),
          //   shop_id: this.shop_id,
          var that = this;
          that.setData({
            loading: 1,
            disabled: 1
          });
          var url = 'mall/order/delivery_dada';
          if (this.data.type == 'ele') {
            url = 'mall/order/delivery_ele';
          }
          app.post(url, {
            order_sn: this.data.order_sn,
            remark: $("#formSubmit2").find("[name='remark']").val(),
            order_weight: $("#formSubmit2").find("[name='order_weight']").val(),
            method: 'POST'
          }, function (data) {
            if (data.code == 200) {
              app.alert('操作成功');
              that.popup2 = 0;
              that.loadOrder(1);
            } else {
              app.alert(data.msg);
              that.setData({
                loading: 0,
                disabled: 0
              });
            }
          });
        },
        setData: function setData(arr) {
          for (var i in arr) {
            this[i] = arr[i];
          }
        },

        //打印小票
        orderPrint: function orderPrint(e) {
          var order_sn = $(e.target).attr("order_sn");
          var shop_id = $(e.target).attr("shop_id");
          var that = this;
          var tmp = {};
          tmp[order_sn] = 1;
          this.setData({
            orderPrintloading: tmp,
            orderPrintdisabled: tmp
          });
          app.get('mall-admin/mall-order/orderPrint', {
            order_sn: order_sn,
            shop_id: shop_id
          }, function (data) {
            tmp[order_sn] = 0;
            that.setData({
              orderPrintloading: tmp,
              orderPrintdisabled: tmp
            });
            if (data.error === 0) {
              app.alert('打印指令发送成功');
            } else {
              app.alert(data.msg);
            }
          });
        },

        topay: function topay(e) {}

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

'use strict';

define(function (require, exports, module) {
    var Router = new VueRouter({
        routes: [{
            path: '/:type',
            name: 'order',
            page: 'cache',
            title: '订单管理'
        }, {
            path: '/orderDetail/:order_sn',
            name: 'orderDetail',
            title: '订单详情'
        }, {
            path: '/eatInHallOrder/:order_sn',
            name: 'eatInHallOrder',
            title: '订单详情'
        }, {
            path: '/bookDetail/:order_sn',
            name: 'bookDetail',
            title: '订单详情'
        }]
    });
    module.exports = Router;
});

"use strict";

define("./js/bookDetail", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    data: ""
                };
            },
            el: "#pageBookDetail",
            created: function created() {
                this.fetchData();
            },
            methods: {
                fetchData: function fetchData() {
                    this.loadOrder();
                },
                // onShow:function(){
                //    this.loadOrder();
                // },
                setData: function setData(arr) {
                    for (var i in arr) {
                        this[i] = arr[i];
                    }
                },
                loadOrder: function loadOrder() {
                    var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
                    var that = this;
                    if (reload == 1) {
                        app.setPageData("oms/order", {
                            reload: 1
                        });
                    }
                    app.get("apiv2/order/find", {
                        order_sn: this.$route.params.order_sn
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.data = res.data;
                    });
                },
                //确认接单
                book_receiving: function book_receiving(order_sn) {
                    var that = this;
                    app.get("/mall/dining_table_book/receiving", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //取消
                book_cancel: function book_cancel(order_sn) {
                    var that = this;
                    app.get("/mall/dining_table_book/cancel", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //取消
                book_complete: function book_complete(order_sn) {
                    var that = this;
                    app.get("/mall/dining_table_book/complete", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/eatInHallOrder", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    data: "",
                    popup3: 0,
                    remark: "",
                    refund_money: 0
                };
            },
            el: "#pageEatInHallOrder",
            created: function created() {
                this.fetchData();
            },
            methods: {
                fetchData: function fetchData() {
                    this.loadOrder();
                },
                //  onShow:function(){
                //    this.loadOrder();
                // },
                setData: function setData(arr) {
                    for (var i in arr) {
                        this[i] = arr[i];
                    }
                },
                loadOrder: function loadOrder() {
                    var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
                    var that = this;
                    app.get("apiv2/order/find", {
                        order_sn: this.$route.params.order_sn
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.data = res.data;
                    });
                },
                //出餐中
                eat_in_hall_receiving: function eat_in_hall_receiving(order_sn) {
                    // var order_sn = $(e.target).attr("order_sn");
                    // var shop_id = $(e.target).attr("shop_id");
                    var that = this;
                    app.get("mall/eat_in_hall_order/receiving", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //出餐完成
                eat_in_hall_complete: function eat_in_hall_complete(order_sn) {
                    var that = this;
                    app.get("mall/eat_in_hall_order/complete", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //取消 退款
                eat_in_hall_cancel: function eat_in_hall_cancel() {
                    var that = this;
                    that.setData({
                        loading: 1,
                        disabled: 1
                    });
                    // if (!this.remark){
                    //   app.alert('请输入备注!');
                    //   return ;
                    // }
                    // if (!this.refund_money ) {
                    //   app.alert('请输入退回金额!');
                    //   return;
                    // }
                    app.get("mall/eat_in_hall_order/cancel", {
                        order_sn: this.order_sn,
                        refund_desc: this.remark,
                        refund_money: this.refund_money
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.hide_refund_money();
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                            that.setData({
                                loading: 0,
                                disabled: 0
                            });
                        }
                    });
                },
                show_refund_money: function show_refund_money(e) {
                    var order_sn = $(e.target).attr("order_sn");
                    var refund_money = $(e.target).attr("refund_money");
                    var paystatus = $(e.target).attr("paystatus");
                    this.setData({
                        order_sn: order_sn,
                        refund_money: refund_money
                    });
                    if (refund_money > 0 && paystatus == 1) {
                        this.setData({
                            popup3: 1
                        });
                    } else {
                        this.eat_in_hall_cancel();
                    }
                },
                hide_refund_money: function hide_refund_money() {
                    this.popup3 = 0;
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/main", [ "app" ], function(require) {
    var PuthinkApp = require("app");
    //vue 组件
    // require('js/component');
    //zach
    //配置文件
    var params = {
        apiDomain: seajs.data.apiDomain ? seajs.data.apiDomain : "https://www.bestsmartbee.com/",
        //接口域名 不带"/"
        domain: "",
        //网站域名  不带"/",
        appname: seajs.data.appname,
        debug: seajs.data.debug ? seajs.data.debug : false,
        versions: seajs.data.versions ? seajs.data.versions : "6.8",
        userVersions: seajs.data.userVersions ? seajs.data.userVersions : "6.9"
    };
    //app 实例之后 ， 只执行一次
    PuthinkApp.afterInit = function() {
        var _hmt = _hmt || [];
    };
    //页面显示时引用，每次都会执行
    PuthinkApp.pageShow = function(params) {
        var name = params.name;
    };
    //实例化app
    window.app = new PuthinkApp(params);
    app.login(function() {
        app.init();
    });
});

"use strict";

define("./js/order", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    loading: 0,
                    page: 1,
                    status: 0,
                    lastpage: 0,
                    listData: [],
                    orderPrintloading: {},
                    orderPrintdisabled: {},
                    popup3: 0,
                    popup: 0,
                    popup2: 0,
                    remark: "",
                    nodata: 0,
                    refund_money: 0
                };
            },
            el: "#pageOrder",
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {
                // console.log("123");
                if (this.mounted == 1) {
                    return;
                }
                var that = this;
                app.pager("#pageOrder", function() {
                    that.loadOderList();
                });
                this.mounted = 1;
            },
            methods: {
                fetchData: function fetchData() {
                    if (this.$route.params.status) {
                        this.status = this.$route.params.status;
                    }
                    this.loadOderList();
                },
                setStatus: function setStatus(status) {
                    // var status = $(e.target).attr("data-status");
                    if (this.status === status) {
                        return;
                    }
                    console.log(status);
                    this.status = status;
                    this.loadOderList(1);
                },
                topay: function topay(e) {},
                loadOderList: function loadOderList(reload) {
                    var that = this;
                    if (reload == 1) {
                        this.loading = 0;
                        this.page = 1;
                        this.lastpage = 0;
                        this.nodata = 0;
                    }
                    var page = this.page;
                    if (this.loading == 1 || this.lastpage == 1) {
                        return;
                    }
                    this.loading = 1;
                    app.get("apiv2/order/get", {
                        page: page,
                        limit: 10,
                        status: this.status,
                        order: "addtime desc"
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        // console.log(res);
                        if (res.data.list.length === 0) {
                            that.lastpage = 1;
                        }
                        that.page++;
                        if (reload == 1) {
                            that.listData = res.data.list;
                        } else {
                            var listData = that.listData;
                            that.listData = listData.concat(res.data.list);
                        }
                        if (that.listData.length === 0) {
                            that.nodata = 1;
                        } else {
                            that.nodata = 0;
                        }
                    });
                },
                pageShow: function pageShow() {
                    var reload = app.getPageData("oms/order", "reload");
                    console.log(reload);
                    if (reload) {
                        app.setPageData("oms/order", {
                            reload: 0
                        });
                        this.loadOderList(1);
                    }
                },
                // 取消定
                cancel_order: function cancel_order() {
                    if (this.order_type == "shopping") {
                        this.shopping_cancel();
                    } else if (this.order_type == "book") {
                        this.book_cancel();
                    } else if (this.order_type == "eat_in_hall") {
                        this.eat_in_hall_cancel();
                    }
                },
                show_refund_money: function show_refund_money(e) {
                    var order_sn = $(e.target).attr("order_sn");
                    var refund_money = $(e.target).attr("refund_money");
                    var paystatus = $(e.target).attr("paystatus");
                    var order_type = $(e.target).attr("order_type");
                    this.setData({
                        order_sn: order_sn,
                        refund_money: refund_money,
                        order_type: order_type
                    });
                    if (refund_money > 0 && paystatus == 1) {
                        this.setData({
                            popup3: 1
                        });
                    } else {
                        this.cancel_order();
                    }
                },
                hide_refund_money: function hide_refund_money() {
                    this.popup3 = 0;
                },
                //确认接单
                book_receiving: function book_receiving(order_sn) {
                    var that = this;
                    app.get("/mall/dining_table_book/receiving", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //取消
                book_cancel: function book_cancel(order_sn) {
                    var that = this;
                    app.get("/mall/dining_table_book/cancel", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //取消
                book_complete: function book_complete(order_sn) {
                    var that = this;
                    app.get("/mall/dining_table_book/complete", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                // 取消订单
                shopping_cancel: function shopping_cancel() {
                    var that = this;
                    app.get("/mall/order/cancel", {
                        order_sn: this.order_sn,
                        refund_desc: this.remark,
                        refund_money: this.refund_money
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //确认接单
                shopping_receiving: function shopping_receiving(order_sn) {
                    var that = this;
                    app.get("/mall/order/receiving", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //配送完成
                shopping_complete: function shopping_complete(order_sn) {
                    var that = this;
                    app.get("/mall/order/complete", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //选择配送
                deliverMallOrder: function deliverMallOrder(e) {
                    var that = this;
                    this.shop_id = $(e.target).attr("shop_id");
                    this.order_sn = $(e.target).attr("order_sn");
                    app.handle([ {
                        text: "自营配送",
                        methods: function methods() {
                            that.popup = 1;
                        }
                    }, {
                        text: "蜂鸟配送",
                        methods: function methods() {
                            that.popup2 = 1;
                        }
                    } ]);
                },
                //自己配送
                deliver_diy: function deliver_diy(e) {
                    var that = this;
                    that.setData({
                        loading: 1,
                        disabled: 1
                    });
                    app.post("mall/order/delivery_diy", {
                        order_sn: this.order_sn,
                        remark: $("#formSubmit").find("[name='remark']").val(),
                        tracking_number: $("#formSubmit").find("[name='tracking_number']").val(),
                        method: "POST"
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.popup = 0;
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                            that.setData({
                                loading: 0,
                                disabled: 0
                            });
                        }
                    });
                },
                //蜂鸟配送
                deliver: function deliver(e) {
                    // remark: $("#formSubmit").find("[name='remark']").val(),
                    //   tracking_number: $("#formSubmit").find("[name='tracking_number']").val(),
                    //   shop_id: this.shop_id,
                    var that = this;
                    that.setData({
                        loading: 1,
                        disabled: 1
                    });
                    var url = "mall/order/delivery_dada";
                    if (this.data.type == "ele") {
                        url = "mall/order/delivery_ele";
                    }
                    app.post(url, {
                        order_sn: this.data.order_sn,
                        remark: $("#formSubmit2").find("[name='remark']").val(),
                        order_weight: $("#formSubmit2").find("[name='order_weight']").val(),
                        method: "POST"
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.popup2 = 0;
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                            that.setData({
                                loading: 0,
                                disabled: 0
                            });
                        }
                    });
                },
                //打印小票
                orderPrint: function orderPrint(e) {
                    var order_sn = $(e.target).attr("order_sn");
                    var shop_id = $(e.target).attr("shop_id");
                    var that = this;
                    var tmp = {};
                    tmp[order_sn] = 1;
                    this.setData({
                        orderPrintloading: tmp,
                        orderPrintdisabled: tmp
                    });
                    app.get("mall-admin/mall-order/orderPrint", {
                        order_sn: order_sn,
                        shop_id: shop_id
                    }, function(data) {
                        tmp[order_sn] = 0;
                        that.setData({
                            orderPrintloading: tmp,
                            orderPrintdisabled: tmp
                        });
                        if (data.error === 0) {
                            app.alert("打印指令发送成功");
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //出餐中
                eat_in_hall_receiving: function eat_in_hall_receiving(order_sn) {
                    // var order_sn = $(e.target).attr("order_sn");
                    // var shop_id = $(e.target).attr("shop_id");
                    var that = this;
                    app.get("mall/eat_in_hall_order/receiving", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //出餐完成
                eat_in_hall_complete: function eat_in_hall_complete(order_sn) {
                    var that = this;
                    app.get("mall/eat_in_hall_order/complete", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //取消 退款
                eat_in_hall_cancel: function eat_in_hall_cancel() {
                    var that = this;
                    that.setData({
                        loading: 1,
                        disabled: 1
                    });
                    // if (!this.remark){
                    //   app.alert('请输入备注!');
                    //   return ;
                    // }
                    // if (!this.refund_money ) {
                    //   app.alert('请输入退回金额!');
                    //   return;
                    // }
                    app.get("mall/eat_in_hall_order/cancel", {
                        order_sn: this.order_sn,
                        refund_desc: this.remark,
                        refund_money: this.refund_money
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.hide_refund_money();
                            that.loadOderList(1);
                        } else {
                            app.alert(data.msg);
                            that.setData({
                                loading: 0,
                                disabled: 0
                            });
                        }
                    });
                },
                setData: function setData(arr) {
                    for (var i in arr) {
                        this[i] = arr[i];
                    }
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/orderDetail", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    data: "",
                    prinrting: 0,
                    mainorder: {},
                    popup3: 0,
                    popup: 0,
                    popup2: 0,
                    remark: "",
                    refund_money: 0
                };
            },
            el: "#pageOrderDetail",
            created: function created() {
                this.fetchData();
            },
            methods: {
                fetchData: function fetchData() {
                    this.loadOrder();
                },
                // onShow:function(){
                //    this.loadOrder();
                // },
                loadOrder: function loadOrder() {
                    var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
                    var that = this;
                    if (reload == 1) {
                        app.setPageData("oms/order", {
                            reload: 1
                        });
                    }
                    this.loading = 1;
                    // app.get("mall/order/find", {
                    //   order_sn: this.$route.params.order_sn
                    // }, function (res) {
                    //   that.loading = 0;
                    //   if (res.code != 200) {
                    //     app.alert(res.msg);
                    //     return;
                    //   }
                    //   that.data= res.data;
                    // });
                    app.get("apiv2/order/find", {
                        order_sn: this.$route.params.order_sn
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.mainorder = res.data;
                        that.data = res.data.sub_order;
                    });
                },
                show_refund_money: function show_refund_money(e) {
                    var order_sn = $(e.target).attr("order_sn");
                    var refund_money = $(e.target).attr("refund_money");
                    var paystatus = $(e.target).attr("paystatus");
                    var order_type = $(e.target).attr("order_type");
                    this.setData({
                        order_sn: order_sn,
                        refund_money: refund_money,
                        order_type: order_type
                    });
                    if (refund_money > 0 && paystatus == 1) {
                        this.setData({
                            popup3: 1
                        });
                    } else {
                        this.cancel_order();
                    }
                },
                hide_refund_money: function hide_refund_money() {
                    this.popup3 = 0;
                },
                // 取消定
                cancel_order: function cancel_order() {
                    if (this.order_type == "shopping") {
                        this.shopping_cancel();
                    } else if (this.order_type == "book") {
                        this.book_cancel();
                    } else if (this.order_type == "eat_in_hall") {
                        this.eat_in_hall_cancel();
                    }
                },
                // 取消订单
                shopping_cancel: function shopping_cancel() {
                    var that = this;
                    app.get("/mall/order/cancel", {
                        order_sn: this.order_sn,
                        refund_desc: this.remark,
                        refund_money: this.refund_money
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //确认接单
                shopping_receiving: function shopping_receiving(order_sn) {
                    var that = this;
                    app.get("/mall/order/receiving", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //配送完成
                shopping_complete: function shopping_complete(order_sn) {
                    var that = this;
                    app.get("/mall/order/complete", {
                        order_sn: order_sn
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                //选择配送
                deliverMallOrder: function deliverMallOrder(e) {
                    var that = this;
                    this.shop_id = $(e.target).attr("shop_id");
                    this.order_sn = $(e.target).attr("order_sn");
                    app.handle([ {
                        text: "自营配送",
                        methods: function methods() {
                            that.popup = 1;
                        }
                    }, {
                        text: "蜂鸟配送",
                        methods: function methods() {
                            that.popup2 = 1;
                        }
                    } ]);
                },
                //自己配送
                deliver_diy: function deliver_diy(e) {
                    var that = this;
                    that.setData({
                        loading: 1,
                        disabled: 1
                    });
                    app.post("mall/order/delivery_diy", {
                        order_sn: this.order_sn,
                        remark: $("#formSubmit").find("[name='remark']").val(),
                        tracking_number: $("#formSubmit").find("[name='tracking_number']").val(),
                        method: "POST"
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.popup = 0;
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                            that.setData({
                                loading: 0,
                                disabled: 0
                            });
                        }
                    });
                },
                //蜂鸟配送
                deliver: function deliver(e) {
                    // remark: $("#formSubmit").find("[name='remark']").val(),
                    //   tracking_number: $("#formSubmit").find("[name='tracking_number']").val(),
                    //   shop_id: this.shop_id,
                    var that = this;
                    that.setData({
                        loading: 1,
                        disabled: 1
                    });
                    var url = "mall/order/delivery_dada";
                    if (this.data.type == "ele") {
                        url = "mall/order/delivery_ele";
                    }
                    app.post(url, {
                        order_sn: this.data.order_sn,
                        remark: $("#formSubmit2").find("[name='remark']").val(),
                        order_weight: $("#formSubmit2").find("[name='order_weight']").val(),
                        method: "POST"
                    }, function(data) {
                        if (data.code == 200) {
                            app.alert("操作成功");
                            that.popup2 = 0;
                            that.loadOrder(1);
                        } else {
                            app.alert(data.msg);
                            that.setData({
                                loading: 0,
                                disabled: 0
                            });
                        }
                    });
                },
                setData: function setData(arr) {
                    for (var i in arr) {
                        this[i] = arr[i];
                    }
                },
                //打印小票
                orderPrint: function orderPrint(e) {
                    var order_sn = $(e.target).attr("order_sn");
                    var shop_id = $(e.target).attr("shop_id");
                    var that = this;
                    var tmp = {};
                    tmp[order_sn] = 1;
                    this.setData({
                        orderPrintloading: tmp,
                        orderPrintdisabled: tmp
                    });
                    app.get("mall-admin/mall-order/orderPrint", {
                        order_sn: order_sn,
                        shop_id: shop_id
                    }, function(data) {
                        tmp[order_sn] = 0;
                        that.setData({
                            orderPrintloading: tmp,
                            orderPrintdisabled: tmp
                        });
                        if (data.error === 0) {
                            app.alert("打印指令发送成功");
                        } else {
                            app.alert(data.msg);
                        }
                    });
                },
                topay: function topay(e) {}
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/router", [], function(require, exports, module) {
    var Router = new VueRouter({
        routes: [ {
            path: "/:type",
            name: "order",
            page: "cache",
            title: "订单管理"
        }, {
            path: "/orderDetail/:order_sn",
            name: "orderDetail",
            title: "订单详情"
        }, {
            path: "/eatInHallOrder/:order_sn",
            name: "eatInHallOrder",
            title: "订单详情"
        }, {
            path: "/bookDetail/:order_sn",
            name: "bookDetail",
            title: "订单详情"
        } ]
    });
    module.exports = Router;
});

define("./template_js/bookDetail", [], function(require, exports, module) {
    return '  <div class="page-content" v-if="data"><!-- 商品列表 --><div class="cart-goods">      <div class="mymedia">                <!-- <div class="text-over-hidden">预约： {{data.sub_order.dining_table_name}}</div> -->                 <div  class="time" style="margin-top: 5px;"> <span class="light">预约名称</span> {{data.sub_order.dining_table_name}}</div>              <div  class="time "> <span class="light">店名</span>{{data.shop.name}} <span class=\'pd5-h\'>•</span> <a :href="\'tel:\'+data.shop.hotline"> {{data.shop.hotline}} </a></div>              <div  class="time"><span class="light">到店时间</span>{{data.sub_order.time}} </div>              <div  class="time"><span class="light">预约费用</span>{{data.order_amount}} </div>                             <div  class="time"><span class="light">联系人</span> {{data.sub_order.contacts}} <span class=\'pd5-h\'>•</span> <a :href="\'tel:\'+data.sub_order.phone"> {{data.sub_order.phone}} </a> </div>               <div  class="time"><span class="light">人数</span>{{data.sub_order.people}}  </div>               <div  class="time"><span class="light">状态</span><span class="color_0">{{data.statusText}}</span></div>              <div  class="time"><span class="light">备注</span>{{data.sub_order.remark?data.sub_order.remark:\'无\'}} </div>                                          <div class=\'charge-item\' v-for="charge in data.sub_order.promotion_info">               <div class="charge-item-left">{{charge.name}}</div>               <div class="charge-item-right">{{charge.showPrice}}</div>                <div class="clear"></div>              </div>                          <div class="goods-btns" v-if="data.status!=4 && data.status>1">                  <div class="line mgt10" style="    margin-bottom: 10px;"></div>                   <a class="order_btn btn2 border_none" @click="book_receiving(data.order_sn)"  v-if="data.status==2">接受预约</a>                   <a class="order_btn btn border_none" @click="book_cancel(data.order_sn)"  >取消</a>                    <a class="order_btn btn2 border_none" @click="book_complete(data.order_sn)"  v-if="data.status==3">完成</a>                  <div class="clear"></div>              </div>            </div>  </div></div> ';
});

define("./template_js/eatInHallOrder", [], function(require, exports, module) {
    return '  <div class="page-content" v-if="data"><!-- 商品列表 --><div class="cart-goods"><div class="cart-title" bindtap=\'openlocation\' style="border-bottom:1px solid #eee; "><img style="margin-top: 5px"   class=\'ico s_left\' src=\'/apps/user/images/112.png\'/> <span class="s_left"> {{data.shop.name}}  </span> <span class="s_right color_0">{{data.sub_order.statusText}}</span>  <div class="clear"></div></div> <div class="goods-item mgt10" v-for="item in data.sub_order.goods_info">        <image class=\'image\' :src=\'item.default_img+"?imagediv2/1/w/160/h/160"\'></image>        <div class=\'goods-info\'>          <div class="title1 text-over-hidden" >{{item.goods_name}}</div>          <div class="light">{{item.attrs}}</div>           <div class=\'goods-count\'>¥{{item.total_price}} x{{item.count}}</div>         </div>                           <div class="clear"></div> </div>  <div class="line mgt10"></div><div class=\'charge-item\' v-for="charge in data.sub_order.promotion_info"> <div class="charge-item-left">{{charge.name}}</div> <div class="charge-item-right">{{charge.showPrice}}</div>  <div class="clear"></div></div> <div class=\'goods-total-price\'>   共计{{data.sub_order.goods_info.length}}件商品 ， 小计{{data.order_amount}}元 </div> <div class="goods-bottom">       <span v-if="data.paytypeText"> 支付方式：</span>  <span class=" color_0">{{data.paytypeText}}</span> <span class=\'pd5-h\'></span>  <span> 支付状态：</span>  <span class=" color_0">{{data.payStatusText}}</span>     </div>    <div class="line" v-if="data.status>0 && data.status<4"></div><!-- 操作 -->    <div class="goods-bottom color_0"></div>    <div class="goods-btns">                   <div class="order_btn btn border_none" @click=\'eat_in_hall_receiving(data.order_sn)\'  v-if="data.sub_order.status==2"  :shop_id="data.shop_id"  :order_sn="data.order_sn">            接单        </div>        <div class="order_btn btn2 border_none" @click=\'show_refund_money\'  v-if="data.status>0 && data.status!=4"  :refund_money="data.order_amount"  :order_sn="data.order_sn" :paystatus="data.paystatus">            取消订单        </div>         <div class="order_btn btn border_none"  @click=\'eat_in_hall_complete(data.order_sn)\'  v-if="data.sub_order.status==5"  :shop_id="data.shop_id"  :order_sn="data.order_sn"  >            完成        </div>        <div class="clear"></div>    </div><!-- 操完 --></div><div class=\'remark\' >   <div class="remark-text">备注:{{data.sub_order.remark?data.sub_order.remark:\'无\'}}</div>   <div class=\'clear\'></div></div>     <!--退款弹出层-->   <div @click=\'popup3=0\' :class="popup3==1?\'popupBg\':\'popupHide\'"></div>  <div :class="popup3==1?\'popup modal-in bw\':\'popup popupHide\'">       <div class="list-li">                      <div class="li"  >                <div class="li-input-text">备注</div>                <div class="li-input">                  <input placeholder=\'请输入退回备注\'   v-model="remark"  name=\'remark\'></input>                </div>                <div class="clear"></div>             </div>              <div class="li"  >                <div class="li-input-text">退回金额</div>                <div class="li-input">                  <input placeholder=\'退回金额\'  name="refund_money" v-model="refund_money"  ></input>                </div>                <div class="clear"></div>             </div>            <div class="btn_group">              <div class="order_btn btn" @click=\'eat_in_hall_cancel\'>提交</div>               <div class="order_btn" @click=\'hide_refund_money\'>取消</div>               <div class="clear"></div>            </div>               </div>         </div>  <!--弹出层-->      </div> ';
});

define("./template_js/order", [], function(require, exports, module) {
    return '<div class="page-content">  <!--pages/order/index.wxml--> <div class="tab">   <div   v-on:click=\'setStatus(0)\'  :class="status==\'\'?\'tabli on\':\'tabli\'"><span>全部</span></div>   <div   v-on:click=\'setStatus(2)\'   :class="status==2?\'tabli on\':\'tabli\'"><span>待处理</span></div>   <div  v-on:click=\'setStatus(3)\'  :class="status==3?\'tabli on\':\'tabli\'"><span>处理中</span></div>   <div   v-on:click=\'setStatus(4)\'   :class="status==4?\'tabli on\':\'tabli\'"><span>已完成</span></div></div> <section class="errormsgDiv"   v-if="nodata">    <p class="errormsg">（￣︶￣）/</p>    <p class="errormsg2">没有查到相关订单</p> </section><section v-else>     <div class="cart-goods" style="border:none"  v-for="data in listData" v-if="data.sub_order && data.sub_order.order_sn">    <!-- 扫餐桌码下的订单 -->    <div v-if=\'data.order_type=="book"\'>       <router-link :to="{ name: \'bookDetail\', params: { order_sn: data.order_sn }}"  class="mymedia">                <!-- <div class="text-over-hidden">预约： {{data.sub_order.dining_table_name}}</div> -->                 <div  class="time" style="margin-top: 5px;"> <span class="light">预约名称</span> {{data.sub_order.dining_table_name}}</div>              <div  class="time "> <span class="light">店名</span>{{data.shop.name}} <span class=\'pd5-h\'>•</span> <a :href="\'tel:\'+data.shop.hotline"> {{data.shop.hotline}} </a></div>              <div  class="time"><span class="light">到店时间</span>{{data.sub_order.time}} </div>              <div  class="time"><span class="light">预约费用</span>{{data.order_amount}} </div>                             <div  class="time"><span class="light">联系人</span> {{data.sub_order.contacts}} <span class=\'pd5-h\'>•</span> <a :href="\'tel:\'+data.sub_order.phone"> {{data.sub_order.phone}} </a> </div>               <div  class="time"><span class="light">人数</span>{{data.sub_order.people}}  </div>               <div  class="time"><span class="light">状态</span><span class="color_0">{{data.statusText}}</span></div>              <div  class="time"><span class="light">备注</span>{{data.sub_order.remark?data.sub_order.remark:\'无\'}} </div>              <div class="clear"></div>                                 </router-link>       <div class="goods-btns" v-if="data.status!=4 && data.status>1">                  <div class="line mgt10" style="    margin-bottom: 10px;"></div>                   <a class="order_btn btn2 border_none" @click="book_receiving(data.order_sn)"  v-if="data.status==2">接受预约</a>                   <a class="order_btn btn border_none" @click="book_cancel(data.order_sn)"  >取消</a>                    <a class="order_btn btn2 border_none" @click="book_complete(data.order_sn)"  v-if="data.status==3">完成</a>                  <div class="clear"></div>              </div>    </div>     <!-- 扫餐桌码下的订单 -->     <div v-if=\'data.order_type=="orderOffline"\'>        <div class="cart-title">        <span class="s_left">{{data.shop.name}} • {{data.sub_order.tableInfo.name}}</span>        <span class="s_right color_0">{{data.sub_order.statusText}}</span>        <div class="clear"></div>        </div>         <router-link :to="{ name: \'eatInHallOrder\', params: { order_sn: data.order_sn }}"   :class=" data.sub_order.goods_info.length>1?\'goods-item-list goods-item-list-more\':\'goods-item-list\'">          <div class="goods-item" v-for="item in data.sub_order.goods_info">                  <image class=\'image\' :src=\'item.default_img+"?imagediv2/1/w/160/h/160"\'></image>                  <div class=\'goods-info\'>                    <div class="title1 span-over-hidden" >{{item.goods_name}}</div>                    <div class="light">{{item.attrs}}</div>                  </div>                                  <div class="clear"></div>          </div>           <div class="clear"></div>        </router-link>          <div class="goods-bottom">          共{{data.sub_order.goods_info.length}}件商品 <span>  应付¥ {{data.order_amount}}</span>         </div>        <div class="goods-bottom">           <span v-if="data.paytypeText"> 支付方式：</span>  <span class=" color_0">{{data.paytypeText}}</span> <span class=\'pd5-h\'></span>  <span> 支付状态：</span>  <span class=" color_0">{{data.payStatusText}}</span>         </div>        <div class="line"></div>        <div class="goods-bottom color_0"></div>        <div class="goods-btns">             <!-- <div class="order_btn btn2 border_none" @click=\'topay\' :data-order_sn="data.order_sn" v-if="data.status==1">收款</div> -->             <router-link   :to="{ name: \'eatInHallOrder\', params: { order_sn: data.order_sn }}" class="order_btn" >查看订单</router-link>                         <div class="order_btn btn border_none" @click=\'eat_in_hall_receiving(data.order_sn)\'  v-if="data.sub_order.status==2"  :shop_id="data.shop_id"  :order_sn="data.order_sn">                接单            </div>            <div class="order_btn btn2 border_none"  v-if="data.status>0 && data.status!=4"  :refund_money="data.order_amount"  :order_sn="data.order_sn" :paystatus="data.paystatus"  @click=\'show_refund_money\'  order_type="eat_in_hall">                取消订单            </div>             <div class="order_btn btn border_none"  @click=\'eat_in_hall_complete(data.order_sn)\'  v-if="data.sub_order.status==5"  :shop_id="data.shop_id"  :order_sn="data.order_sn"  >                完成            </div>            <div class="clear"></div>        </div>    </div>          <!-- 扫餐桌码下的结束 -->     <!-- 商品购买shopping-->    <div v-if=\'data.order_type=="shopping"\'>        <div class="cart-title">        <span class="s_left" style="max-width: 70%;">{{data.shop.name}} • {{data.title}}</span>        <span class="s_right color_0">{{data.sub_order.statusText}}</span>        <div class="clear"></div>        </div>         <router-link :to="{ name: \'orderDetail\', params: { order_sn: data.order_sn }}"   :class=" data.sub_order.goods_info.length>1?\'goods-item-list goods-item-list-more\':\'goods-item-list\'">          <div class="goods-item" v-for="item in data.sub_order.goods_info">                  <image class=\'image\' :src=\'item.default_img+"?imagediv2/1/w/160/h/160"\'></image>                  <div class=\'goods-info\'>                    <div class="title1 span-over-hidden" >{{item.goods_name}}</div>                    <div class="light">{{item.attrs}}</div>                  </div>                                  <div class="clear"></div>          </div>           <div class="clear"></div>        </router-link>        <div class="goods-bottom">          共{{data.sub_order.goods_info.length}}件商品 <span>  实付¥ {{data.order_amount}}        </div>        <div class="goods-bottom">           <span v-if="data.paytypeText"> 支付方式：</span>  <span class=" color_0">{{data.paytypeText}}</span> <span class=\'pd5-h\'></span>  <span> 支付状态：</span>  <span class=" color_0">{{data.payStatusText}}</span>         </div>        <div class="line"></div>        <div class="goods-bottom color_0">{{data.sub_order.deliver_type}} {{data.sub_order.deliver_time_str}}</div>        <div class="goods-btns">                                    <router-link   :to="{ name: \'orderDetail\', params: { order_sn: data.order_sn }}" class="order_btn" >查看订单</router-link>     <div class="order_btn btn2" @click=\'show_refund_money\'  v-if="data.status>0  && data.status!=4"  :order_sn="data.order_sn" :shop_id="data.shop_id" :data-refund_money="data.order_amount" :paystatus="data.paystatus" order_type="shopping" >                取消订单            </div>             <div  class="buttonNone order_btn btn4 "  v-if="data.status>1"  :loading="orderPrintloading[data.order_sn]" disabled="orderPrintdisabled[data.order_sn]" @click=\'orderPrint\'  :shop_id="data.shop_id"   :order_sn="data.order_sn">                打印            </div>                           <div class="order_btn btn"  @click=\'shopping_complete(data.order_sn)\'  v-if="data.sub_order.status==5"  :shop_id="data.shop_id"  :order_sn="data.order_sn">                完成            </div>             <div class="order_btn btn2"  @click=\'deliverMallOrder\' v-if="data.sub_order.status==6"  :shop_id="data.shop_id"  :order_sn="data.order_sn">                配送            </div>              <div class="order_btn btn" @click=\'shopping_receiving(data.order_sn)\'  v-if="data.status==2"  :shop_id="data.shop_id"  :order_sn="data.order_sn">                接单            </div>            <div class="clear"></div>        </div>    </div>         <!-- 商品购买shop end -->    </div>      </section> <!--自己配送弹出层--> <div @click=\'popup=0\' :class="popup==1?\'popupBg\':\'popupHide\'"></div>  <div :class="popup==1?\'popup modal-in bw\':\'popup popupHide\'">    <div class="popup-title">自营配送</div>    <form id="formSubmit">       <div class="list-li">          <div class="li"  >                <div class="li-input-text">备注</div>                <div class="li-input">                  <input placeholder=\'备注\'  name=\'remark\'></input>                </div>                <div class="clear"></div>             </div>              <div class="li"  >                <div class="li-input-text">运输单号</div>                <div class="li-input">                  <input placeholder=\'可填写快递单号\'  name="tracking_number"   ></input>                </div>                <div class="clear"></div>             </div>              <div class="btn_group">              <div class="order_btn btn" @click=\'deliver_diy\'>提交</div>               <div class="order_btn" @click=\'popup=0\'>取消</div>               <div class="clear"></div>            </div>         </div>         </form>  </div>  <!--弹出层--> <!--蜂鸟配送弹出层-->  <div @click=\'popup2=0\' :class="popup2==1?\'popupBg\':\'popupHide\'"></div>  <div :class="popup2==1?\'popup modal-in bw\':\'popup popupHide\'">    <div class="popup-title">蜂鸟配送</div>    <form id="formSubmit2">      <div class="list-li">          <div class="li"  >                <div class="li-input-text">备注</div>                <div class="li-input">                  <input placeholder=\'备注\'     name=\'remark\'></input>                </div>                <div class="clear"></div>             </div>              <div class="li"  >                <div class="li-input-text">订单总重量</div>                <div class="li-input">                  <input placeholder=\'订单总重量（kg）\'  name="order_weight"   ></input>                </div>                <div class="clear"></div>             </div>           <div class="btn_group">              <div class="order_btn btn" @click=\'deliver\'>提交</div>               <div class="order_btn" @click=\'popup2=0\'>取消</div>               <div class="clear"></div>            </div>               </div>    </form>  </div>  <!--弹出层-->  <!--退款弹出层-->   <div @click=\'popup3=0\' :class="popup3==1?\'popupBg\':\'popupHide\'"></div>  <div :class="popup3==1?\'popup modal-in bw\':\'popup popupHide\'">       <div class="list-li">                      <div class="li"  >                <div class="li-input-text">备注</div>                <div class="li-input">                  <input placeholder=\'请输入退回备注\'   v-model="remark"  name=\'remark\'></input>                </div>                <div class="clear"></div>             </div>              <div class="li"  >                <div class="li-input-text">退回金额</div>                <div class="li-input">                  <input placeholder=\'退回金额\'  name="refund_money" v-model="refund_money"  ></input>                </div>                <div class="clear"></div>             </div>            <div class="btn_group">              <div class="order_btn btn" @click=\'cancel_order\'>提交</div>               <div class="order_btn" @click=\'hide_refund_money\'>取消</div>               <div class="clear"></div>            </div>               </div>         </div>  <!--弹出层-->      </div>';
});

define("./template_js/orderDetail", [], function(require, exports, module) {
    return '  <div class="page-content" v-if="data">  <div class="address" v-if="data.consignee_name">   <div class="address-box">      <div  class="address-left" range="{{delivery_companys}}" >      <div class="address-left-text">{{data.deliver_type}}</div>         </div>     <div class="address-right">       <div class="address-item">            <image class=\'ico\' src=\'/apps/user/images/112.png\'></image>            <div class="title1">            {{data.deliver_address}} </div>            <div class="info"> {{data.consignee_name}}   {{data.phone}}</div>             </div>         <div class="address-item">        <image class=\'ico\' src=\'/apps/user/images/111.png\'></image>        <div class="title1">{{data.deliver_time_str}}</div>                </div>          </div>     <div class="clear"></div>  </div></div><!-- 坐标 --><div v-if="data.deliver_type==\'送货上门\' && data.data.location_info && data.data.location_info.latitude"  class=\'charge-item bgw pd10 chooseCard\' bindtap=\'openUserLocation\'> <div class="charge-item-left">地理位置</div> <div class="charge-item-right" style=\'width:75%;\'> <span  >{{data.data.location_info.address}} {{data.data.location_info.latitude}},{{data.data.location_info.longitude}} </span> </div>  <image class=\'arrowright\' src=\'/apps/user/images/arrowright.png\'></image>  <div class="clear"></div></div><!-- 坐标 --><!-- 快递 --><div v-if="data.orderDeliver"  class=\'charge-item bgw pd10 chooseCard\'> <div class="charge-item-left">配送信息</div> <div class="charge-item-right" style=\'width:75%;\'> <div v-if="data.orderDeliver.tracking_number"> 单号： {{data.orderDeliver.tracking_number}} </div> <div > 备注：{{data.orderDeliver.remark}} </div> </div>  <!-- <image class=\'arrowright\' src=\'/apps/user/images/arrowright.png\'></image> -->  <div class="clear"></div></div><!-- 快递 --><!-- 商品列表 --><div class="cart-goods"><div class="cart-title" bindtap=\'openlocation\'><img style="margin-top: 5px"   class=\'ico s_left\' src=\'/apps/user/images/112.png\'/> <span class="s_left"> {{mainorder.shop.name}} </span> <span class="s_right color_0">{{data.statusText}}</span>  <div class="clear"></div></div> <div class="goods-item" v-for="item in data.goods_info">        <image class=\'image\' :src=\'item.default_img+"?imagediv2/1/w/160/h/160"\'></image>        <div class=\'goods-info\' style="margin-left: 10px">          <div class="title1 text-over-hidden" >{{item.goods_name}}</div>          <div class="light text-over-hidden">{{item.attrs}}</div>                 <div class=\'goods-count\'>¥{{item.total_price}} x {{item.count}}</div>                  </div>          <div class="clear"></div> </div>  <div class="line mgt10"></div><div class=\'charge-item\' v-for="charge in data.promotion_info"> <div class="charge-item-left">{{charge.name}}</div> <div class="charge-item-right">{{charge.showPrice}}</div>  <div class="clear"></div></div> <div class=\'remark\' >    备注:{{data.remark?data.remark:\'无\'}}    </div>    <div class="line"></div><div class=\'goods-total-price\'>   共计{{data.goods_info.length}}件商品 ， 小计{{data.order_amount}}元 </div><div class="goods-bottom">       <span  v-if="mainorder.paytypeText"> 支付方式：</span>  <span class=" color_0">{{mainorder.paytypeText}}</span> <span class=\'pd5-h\'></span>  <span> 支付状态：</span>  <span class=" color_0">{{mainorder.payStatusText}}</span>     </div>        <div class="goods-btns mgt10">         <div class="order_btn btn2" @click=\'show_refund_money\'  v-if="mainorder.status>0  && mainorder.status!=4"  :order_sn="mainorder.order_sn" :shop_id="data.shop_id" :data-refund_money="mainorder.order_amount" :paystatus="mainorder.paystatus" order_type="shopping" >            取消订单        </div>         <div  class="buttonNone order_btn btn4 "  v-if="mainorder.status>1"  :loading="prinrting" disabled="prinrting" @click=\'orderPrint\'  :shop_id="data.shop_id"   :order_sn="mainorder.order_sn">            打印        </div>                   <div class="order_btn btn"  @click=\'shopping_complete(data.order_sn)\'  v-if="data.status==5"  :shop_id="data.shop_id"  :order_sn="data.order_sn">            完成        </div>         <div class="order_btn btn2"  @click=\'deliverMallOrder\' v-if="data.status==6"  :shop_id="data.shop_id"  :order_sn="data.order_sn">            配送        </div>          <div class="order_btn btn" @click=\'shopping_receiving(data.order_sn)\'  v-if="mainorder.status==2"  :shop_id="data.shop_id"  :order_sn="data.order_sn">            接单        </div>        <div class="clear"></div>    </div></div> <div class=\'line\'></div>  <!--自己配送弹出层--> <div @click=\'popup=0\' :class="popup==1?\'popupBg\':\'popupHide\'"></div>  <div :class="popup==1?\'popup modal-in bw\':\'popup popupHide\'">    <div class="popup-title">自营配送</div>    <form id="formSubmit">       <div class="list-li">          <div class="li"  >                <div class="li-input-text">备注</div>                <div class="li-input">                  <input placeholder=\'备注\'  name=\'remark\'></input>                </div>                <div class="clear"></div>             </div>              <div class="li"  >                <div class="li-input-text">运输单号</div>                <div class="li-input">                  <input placeholder=\'可填写快递单号\'  name="tracking_number"   ></input>                </div>                <div class="clear"></div>             </div>              <div class="btn_group">              <div class="order_btn btn" @click=\'deliver_diy\'>提交</div>               <div class="order_btn" @click=\'popup=0\'>取消</div>               <div class="clear"></div>            </div>         </div>         </form>  </div>  <!--弹出层--> <!--蜂鸟配送弹出层-->  <div @click=\'popup2=0\' :class="popup2==1?\'popupBg\':\'popupHide\'"></div>  <div :class="popup2==1?\'popup modal-in bw\':\'popup popupHide\'">    <div class="popup-title">蜂鸟配送</div>    <form id="formSubmit2">      <div class="list-li">          <div class="li"  >                <div class="li-input-text">备注</div>                <div class="li-input">                  <input placeholder=\'备注\'     name=\'remark\'></input>                </div>                <div class="clear"></div>             </div>              <div class="li"  >                <div class="li-input-text">订单总重量</div>                <div class="li-input">                  <input placeholder=\'订单总重量（kg）\'  name="order_weight"   ></input>                </div>                <div class="clear"></div>             </div>           <div class="btn_group">              <div class="order_btn btn" @click=\'deliver\'>提交</div>               <div class="order_btn" @click=\'popup2=0\'>取消</div>               <div class="clear"></div>            </div>               </div>    </form>  </div>  <!--弹出层-->  <!--退款弹出层-->   <div @click=\'popup3=0\' :class="popup3==1?\'popupBg\':\'popupHide\'"></div>  <div :class="popup3==1?\'popup modal-in bw\':\'popup popupHide\'">       <div class="list-li">                      <div class="li"  >                <div class="li-input-text">备注</div>                <div class="li-input">                  <input placeholder=\'请输入退回备注\'   v-model="remark"  name=\'remark\'></input>                </div>                <div class="clear"></div>             </div>              <div class="li"  >                <div class="li-input-text">退回金额</div>                <div class="li-input">                  <input placeholder=\'退回金额\'  name="refund_money" v-model="refund_money"  ></input>                </div>                <div class="clear"></div>             </div>            <div class="btn_group">              <div class="order_btn btn" @click=\'cancel_order\'>提交</div>               <div class="order_btn" @click=\'hide_refund_money\'>取消</div>               <div class="clear"></div>            </div>               </div>         </div>  <!--弹出层-->  </div> ';
});

define("./template_js/orderDetailOffline", [], function(require, exports, module) {
    return '  <div class="page-content" v-if="data"><!-- 商品列表 --><div class="cart-goods"><div class="cart-title" bindtap=\'openlocation\' style="border-bottom:1px solid #eee; "><img style="margin-top: 5px"   class=\'ico s_left\' src=\'/apps/user/images/112.png\'/> <span class="s_left"> {{data.shop_name}} </span> <span class="s_right color_0">{{data.sub_order.statusText}}</span>  <div class="clear"></div></div> <div class="goods-item mgt10" v-for="item in data.sub_order.goods_info">        <image class=\'image\' :src=\'item.default_img+"?imagediv2/1/w/160/h/160"\'></image>        <div class=\'goods-info\'>          <div class="title1 text-over-hidden" >{{item.goods_name}}</div>          <div class="light">{{item.attrs}}</div>           <div class=\'goods-count\'>¥{{item.total_price}} x{{item.count}}</div>         </div>                           <div class="clear"></div> </div>  <div class="line mgt10"></div><div class=\'charge-item\' v-for="charge in data.sub_order.promotion_info"> <div class="charge-item-left">{{charge.name}}</div> <div class="charge-item-right">{{charge.showPrice}}</div>  <div class="clear"></div></div> <div class=\'goods-total-price\'>   共计{{data.sub_order.goods_info.length}}件商品 ， 小计{{data.order_amount}}元 </div></div> <div class=\'line\'></div><div class=\'remark\' >   <div class="remark-text">备注:{{data.sub_order.remark?data.sub_order.remark:\'无\'}}</div>   <div class=\'clear\'></div></div> <div class="goods-bottom">       <span> 支付方式：</span>  <span class=" color_0">{{data.paytypeText}}</span> <span class=\'pd5-h\'></span>  <span> 支付状态：</span>  <span class=" color_0">{{data.payStatusText}}</span>     </div>    <div class="line"></div>    <div class="goods-bottom color_0">{{data.sub_order.deliver_type}} {{data.sub_order.deliver_time_str}}</div>    <div class="goods-btns">         <!-- <div class="order_btn btn2 border_none" @click=\'topay\' :data-order_sn="data.order_sn" v-if="data.status==1">收款</div> -->         <router-link   :to="{ name: \'orderDetailOffline\', params: { order_sn: data.order_sn }}" class="order_btn" >查看订单</router-link>                 <div class="order_btn btn border_none" @click=\'eat_in_hall_receiving(data.order_sn)\'  v-if="data.sub_order.status==2"  :shop_id="data.shop_id"  :order_sn="data.order_sn">            接单        </div>        <div class="order_btn btn2 border_none" @click=\'show_refund_money\'  v-if="data.paystatus==1 && data.status!=4"  :refund_money="data.order_amount"  :order_sn="data.order_sn" :paystatus="data.paystatus">            取消        </div>         <div class="order_btn btn border_none"  @click=\'eat_in_hall_complete(data.order_sn)\'  v-if="data.sub_order.status==5"  :shop_id="data.shop_id"  :order_sn="data.order_sn"  >            完成        </div>        <div class="clear"></div>    </div>  <!--退款弹出层-->   <div @click=\'popup3=0\' :class="popup3==1?\'popupBg\':\'popupHide\'"></div>  <div :class="popup3==1?\'popup modal-in bw\':\'popup popupHide\'">       <div class="list-li">                      <div class="li"  >                <div class="li-input-text">备注</div>                <div class="li-input">                  <input placeholder=\'请输入退回备注\'   v-model="remark"  name=\'remark\'></input>                </div>                <div class="clear"></div>             </div>              <div class="li"  >                <div class="li-input-text">退回金额</div>                <div class="li-input">                  <input placeholder=\'退回金额\'  name="refund_money" v-model="refund_money"  ></input>                </div>                <div class="clear"></div>             </div>            <div class="btn_group">              <div class="order_btn btn" @click=\'eat_in_hall_cancel\'>提交</div>               <div class="order_btn" @click=\'hide_refund_money\'>取消</div>               <div class="clear"></div>            </div>               </div>         </div>  <!--弹出层-->      </div> ';
});
